programme per cron stoppen und starten

Jan 'RedBully' Seiffert redbully at cc.fh-luh.de
Fri Nov 10 00:15:11 CET 2006


Thomas Balsfulland wrote:
> hallo zusammen,
> 
> ich habe probleme programme per cron zu stoppen oder starten.
> ich moechte gerne
> 
>    /etc/init.d/DvISEctl stop   (tobit david)    oder
>    /etc/init.d/samba stop
> 
> per cron ausfuehren, was aber scheitert. allerdings starte ich aus cron
> ein 5-zeiler, in dem dann unter anderem die oben genannten zeilen stehen
> cron schickt mir eine mail, in der steht:
> 
>> stty: Standardeingabe: Das Argument ist ung
>>
>> stty: Standardeingabe: Das Argument ist ung
>> stopping DvISE module postman ...
>> ^[[C^[[10D^[[1A.....done^O
>> stty: Standardeingabe: Das Argument ist ung
>> stopping DvISE module dvgrab ...
>> ^[[C^[[10D^[[1A.....done^O
>> stty: Standardeingabe: Das Argument ist ung
>> stty: Standardeingabe: Das Argument ist ung
>> stopping DvISE module replica ...
>> ^[[C^[[10D^[[1A.....done^O
>> stty: Standardeingabe: Das Argument ist ung
>> stopping DvISE module webbox ...
>> ^[[C^[[10D^[[1A.....done^O
>> stty: Standardeingabe: Das Argument ist ung
>> stty: Standardeingabe: Das Argument ist ung
>> stty: Standardeingabe: Das Argument ist ung
>> stopping DvISE module sl ...
>> ^[[C^[[10D^[[1A.....done^O
>> stty: Standardeingabe: Das Argument ist ung
> 
Ich kann mich ja taeuschen, aber da steht "done"
Also das scheint beendet zu sein. Oder nicht?
Und das genoehle mit stty (so wie die control-char), entweder ist das
das start-stop-script (bzw. start-stop-daemon), oder es ist Davidctl.

Liegt wohl daran, das in der etwas eingeschraenkten Umgebung eines Cron
scripts es irgendwas erwartet, was nicht da ist. (Oder gleich ganz
verkacken auf eine Interaktive Shell/Ein-/Ausgabe zu testen, hmmm, ich
tippe dann mal darauf, das nicht start-stop-daemon das Problem ist...)

> oder bei samba:
> 
>> Stopping Samba daemons: /etc/init.d/samba: line 39: start-stop-daemon:
>> command not found
>> nmbd/etc/init.d/samba: line 51: start-stop-daemon: command not found
>>  smbd.
>> Starting Samba daemons: nmbd/etc/init.d/samba: line 27:
>> start-stop-daemon: command not found
>>  smbd/etc/init.d/samba: line 31: start-stop-daemon: command not found
> 

Hier was aehnliches, ich schaetze innerhalb des Skriptes unter Cron
sieht der $PATH anders aus, so das smbd/nmbd da nicht mehr drin liegen.

> 
> und so stoppen die programme nicht.
> hintergrund: bevor ich eine datensicherung auf band starte, sollte samba
> und tobit gestoppt werden.
Verstaendlich, Tobit's Software reagiert manchmal etwas unverhersagbar
und empfindlich..

> so sieht dann mein 5-zeiler aus:
> 
Ich stoppe und starte selber aus cron skripten Dienste, allerdings unter
gentoo, da klappt das.

pack doch mal ein "echo $PATH" darein.

> #!/bin/sh
>   mt -f /dev/nst0 status | grep ONLINE &> /dev/null
> 
> if [ $? -eq 0 ]; then
>   /etc/init.d/samba stop;
>   /etc/init.d/DvISEctl stop;
> 
>   tar cf /dev/nst0 /home /opt/david /etc /var/log;
> 
>   /etc/init.d/DvISEctl start;
>   /etc/init.d/samba start;
> else
>   echo "Es ist kein Band im Laufwerk";
>   exit 1;
> fi
> 
> 
> hat jemand einen tip was ich falsch mache?
> 
Das enviroment deines Skriptes nicht unter die Lupe nehmen? ;)

> 
> gruss
>   thomas
> 
Gruss
	Jan

-- 
If you pay danegeld to the vikings they will build more long-boats.
If you pay protection money to some racketeers, they will hire more
thugs.
If you pay license fees to patent trolls, they will buy more patents.



More information about the Linux mailing list