• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

Root-Shell-Script in Autostart

Hi Leute
Ich möchte, dass bei jedem Systemstart folgendes Script ausgeführt wird:

Code:
#!/bin/sh
rcfirestarter start

Das Script kann nur als Root ausgeführt werde.
Wohin muss ich das Script reintun, dass bei jedem Systemstart dieses Script ausgeführt wird ohne dass ich das root-passwort eingeben muss ?

Cu
 

oc2pus

Ultimate Guru
schau im FAQ-Forum hier:
[Allgemein] runlevel scripte - Scripts selber erstellen
http://www.linux-club.de/viewtopic.php?t=16069
 
OP
L

Linux-Sinner

Member
Ich habe aber keine Ahnung welche Dienste da vorher gestartet werden müssen ? (das Programm ist ne Firewall)

Ich nehme mal an $network, aber welche müssen da noch da sein ?
 
OP
L

Linux-Sinner

Member
GIbt es nicht noch ne andere Möglichkeit ? Ich will ja nur den einen Befehl als root ausführen, da wird es doch wohl noch ne leichtere Möglichkeit geben !
 
OP
L

Linux-Sinner

Member
hab jetzt einfach
rcfirestarter start
reingeschrieben, aber genutzt hat es gar nix -_-
Sonst noch ne Idee, vielleicht so,dass er das Script mithilfe von KDE ausführt ?
 
A

Anonymous

Gast
Versuch doch mal

Code:
/sbin/rcfirestarter start

Sicherheitshalber Neustart.

Testen kannst Du das Ergebnis mit

Code:
rcfirestarter status

Btw. Firestarter steht bei mir (Allerdings SuSE 10.0) im Runleveleditor in Yast.

Edit: Schau mal, ob Du nicht Firestarter hier drin hast:

Code:
/opt/gnome/etc/firestarter/firestarter.sh

Greetz,

RM
 
OP
L

Linux-Sinner

Member
Rain_Maker schrieb:
Versuch doch mal

Code:
/sbin/rcfirestarter start

Sicherheitshalber Neustart.

Testen kannst Du das Ergebnis mit

Code:
rcfirestarter status

Btw. Firestarter steht bei mir (Allerdings SuSE 10.0) im Runleveleditor in Yast.

Edit: Schau mal, ob Du nicht Firestarter hier drin hast:

Code:
/opt/gnome/etc/firestarter/firestarter.sh

Greetz,

RM
Der Befehl /sbin/rcfirestarter start funzt natürlich schon, aber nach Neustart ist die Firewall halt leider nicht mehr an und muss wieder manuell gestartet werden.

Firestarter ist bei mir auch im Runleveleditor drin, aber obwohl ich ihn dort für Runlevel 3 und 5 aktiviert hab, und auch beim Booten immer dransteht, dass er Firestarter erfolgreich gestartet hat (grünes Done!), ist er eben nicht gestartet :( (wenn ich es dann nämlich mit "rcfirestarter status" teste, läuft er nicht ...)

Meine Firestarter.sh befindet sich in /etc/firestarter/firestarter.sh
In /opt/gnome gibt es ne ausführbare Datei namens firestarter.
 

oc2pus

Ultimate Guru
wenn du das in boot.local schreibst, dann bitte mit vollem Pfad!

also
Code:
/sbin/rcfirestarter start

und ich verstehe NICHT warum du das nicht mit dem YaST Runlevel-Editor aktivierts für runlevel 3 und 5 ?
 
OP
L

Linux-Sinner

Member
Hmm ein script das rcfirestarter heißt gibt es irgendwie gar net, aber dafür eins das nur firestarter heißt und in /etc/init.d ist: (bzw es gibt schon rcfirestarter, aber das ist ne Verknüpfung zu firestarter)

Code:
#!/bin/sh
#
# Startup script for the Firestarter Application Suite
# adapted for SuSE Linux
#
# chkconfig: 2345 11 92
#
# description: Automates the startup of Firestarter's generated ruleset
#
# Script Author: Tomas Junnonen <tomas@fs-security.com>
#
# and for SuSE Linux adaptations : Sebastien Corot <scorot@libertysurf.fr>
#
# config: /etc/firestarter/configuration
#
### BEGIN INIT INFO
# Provides:          firestarter
# Required-Start:    $network
# Required-Stop:     $SuSEfirewall2
# Should-Stop:
# Default-Start:     3 5
# Default-Stop:
# Short-Description: firestater is a firewall
# Description:       Start firestarter to protect you host and/or network
### END INIT INFO

# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     be verbose in local rc status and clear it afterwards
#      rc_status -v -r  ditto and clear both the local and overall rc status
#      rc_status -s     display "skipped" and exit with status 3
#      rc_status -u     display "unused" and exit with status 3
#      rc_failed        set local and overall rc status to failed
#      rc_failed <num>  set local and overall rc status to <num>
#      rc_reset         clear both the local and overall rc status
#      rc_exit          exit appropriate to overall rc status
#      rc_active        checks whether a service is activated by symlinks
#      rc_splash arg    sets the boot splash screen to arg (if active)
. /etc/rc.status

# Reset status of this service
rc_reset

# Return values acc. to LSB for all commands but status:
# 0	  - success
# 1       - generic or unspecified error
# 2       - invalid or excess argument(s)
# 3       - unimplemented feature (e.g. "reload")
# 4       - user had insufficient privileges
# 5       - program is not installed
# 6       - program is not configured
# 7       - program is not running
# 8--199  - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
# 
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signaling is not supported) are
# considered a success.

# Check that firestarter is installed.
FIRESTARTER_BIN=/opt/gnome/bin/firestarter
test -x $FIRESTARTER_BIN || { echo "$FIRESTARTER_BIN not installed"; 
	if [ "$1" = "stop" ]; then exit 0;
	else exit 5; fi; }

FS_CONFIG="/etc/firestarter/configuration"
FS_CONTROL="/etc/firestarter/firestarter.sh"

test -r $FS_CONFIG || { echo "$FS_CONFIG not existing";
	if [ "$1" = "stop" ]; then exit 0;
	else exit 6; fi; }
RETVAL=0

start() {
        if [ -f $FS_CONFIG ]; then
	$FS_CONTROL start > /dev/null
	echo -n "Starting the Firestarter firewall:"
	rc_status -v
	fi
}

stop() {
	echo -n "Stopping the Firestarter firewall:"
	$FS_CONTROL stop > /dev/null
	rc_status -v
}

lock() {
	echo -n "Locking the Firestarter firewall:"
	$FS_CONTROL lock > /dev/null
	rc_status -v
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
	if [ -f /var/lock/subsys/firestarter ]; then
	echo -n "Firestarter is running..."
	rc_failed -0
	# NOTE: rc_status knows that we called this init script with
	# "status" option and adapts its messages accordingly.
	rc_status -v
	else 
	echo -n "Firestarter is stopped"
	rc_failed -7
	# NOTE: rc_status knows that we called this init script with
	# "status" option and adapts its messages accordingly.
	rc_status -u
	fi
	;;
  restart)
	if [ -f /var/lock/subsys/firestarter ]; then
            stop
            start
        fi
	;;
  lock)
	lock
	;;
  *)
	echo "Usage: firestarter {start|stop|restart|lock|status}"
	exit 1
esac
rc_exit
 

oc2pus

Ultimate Guru
das ist schon alles richtig so ..

im YaST Runlevel-Editor AKTIVIEREN für runlevel 3 und 5
und ab geht die lucy :mrgreen:
 
OP
L

Linux-Sinner

Member
Wie bereits gesagt:
Firestarter ist bei mir auch im Runleveleditor drin, aber obwohl ich ihn dort für Runlevel 3 und 5 aktiviert hab, und auch beim Booten immer dransteht, dass er Firestarter erfolgreich gestartet hat (grünes Done!), ist er eben nicht gestartet (wenn ich es dann nämlich mit "rcfirestarter status" teste, läuft er nicht ...)

Großartig etwas falsch machen kann man doch bei der Bedienung des Runlevel-Editors gar net ...
Ich mach im Expertenmodus ein Kreuzlein bei 3 und 5 rein, starte das Teil und fertig. Dann klicke ich auf "Beenden". Nach neustart aber wieder das gleiche Resultat: Kein Firestarter ist gestartet -_-

*Edit:
Hierzu noch meine boot.msg, laut der der Firestarter normal geladen wurde -_-

Code:
Setting up network interfaces:
    lo        
    lo        IP address: 127.0.0.1/8   
Initializing random number generator done
eth0      device: Intel Corporation 82801BA/BAM/CA/CAM Ethernet Controller (rev 01)
    eth0      configuration: eth-id-00:02:a5:af:29:81
    eth0      IP address: 192.168.100.20/24   
done    dsl0      
doneSetting up service network  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .done
dsl0: error fetching interface information: Device not found
dsl0: error fetching interface information: Device not found
dsl0: error fetching interface information: Device not found
Starting the Firestarter firewall:done
 
Moin Linux-Sinner,

aber sonst geht es noch gut? Meinst Du ernsthaft das sich da einer durchkämpft? Sei so gut und kürze das Ganze auf ca. 20 - 30 Zeilen (die Relevanten), da ich es sonst auf 0 Zeilen kürze.
 

oc2pus

Ultimate Guru
Geier0815 schrieb:
Moin Linux-Sinner,

aber sonst geht es noch gut? Meinst Du ernsthaft das sich da einer durchkämpft? Sei so gut und kürze das Ganze auf ca. 20 - 30 Zeilen (die Relevanten), da ich es sonst auf 0 Zeilen kürze.

:mrgreen:

oder bei nopaste einstelllen:
http://www.rafb.net/paste/

ansonsten bin ich auch raus aus dem Thread, viel zu heiss für solche Listings.
 

Martin Breidenbach

Ultimate Guru
Code:
done    dsl0     
doneSetting up service network  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .done
dsl0: error fetching interface information: Device not found
dsl0: error fetching interface information: Device not found
dsl0: error fetching interface information: Device not found
Starting the Firestarter firewall:done

Wenn Du den Firestarter deaktivierst - kommen dann die drei device not found auch ?
 
OP
L

Linux-Sinner

Member
@alle meine Helferlein:
sorry, der gesamte boot-log war wohl echt etwas lang :D

Ich denke mal, es kommt nur auf die paar Zeilen an, die Martin auch schon zitiert hat:
Der "Device not found"-Fehler kommt nur, wenn der Firestarter "aktiviert" ist, also beim Booten zwar "Done" kommt, aber dann im KDE ich in die Konsole gehe, dort mit rcfirestarter überprüfe, ob er geladen ist, und dann feststelle das dies nicht der Fall ist :(
Wenn er "deaktiviert" ist, ich ihn also aus Runlevel 5 rausnehme, rennt alles ohne Fehler durch!

Kann es irgendwie sein, dass der Firestarter als erstes wirklich geladen wird, dann aber die Fehler verursacht, und deswegen wieder gestoppt wird ?
 

oc2pus

Ultimate Guru
Linux-Sinner schrieb:
Kann es irgendwie sein, dass der Firestarter als erstes wirklich geladen wird, dann aber die Fehler verursacht, und deswegen wieder gestoppt wird ?
ja, so sieht es aus.

evtl mal in die /var/log/messages schauen, da ich den firestarter nicht kenne, evtl hat der auch ein eigenes Logfile
 
OP
L

Linux-Sinner

Member
Hmm, also in der messages-Datei ist nix vom Firestarter drinn, was den bootvorgang betrifft ...

Momentan lös ich das Problem jetzt so, dass ich das Script einfach in den Autostart von KDE getan hab, und man jetzt halt bei jedem Start das root-passwort eingeben muss :(

Gibts da nicht irgend ne Möglichkeit, im Script selbst zu simulieren, dass das Passwort eingeben wird ?
Also so, dass ich ins Script z.B.
"keyboard:password" eingebe, und er dann so tut als würde an der Tastatur jemand sitzen und das Wort "password" eingeben, und danach am besten noch Enter drücken :D
Geht das ?(dass der Befehl nicht keyboard: heißt, ist natürlich klar ;) )

*Edit*:
Hab dafür nen extra Thread ( http://www.linux-club.de/viewtopic.php?p=380219#380219 ) gestellt, der hier kann geclost werden
 
Oben