Ein Skript kann beim Start in Debian 7 nicht ausgeführt werden

2167
mulllhausen

Ich möchte, dass dieses Skript beim Start auf meinem Debian Wheezy-Server ausgeführt wird:

/usr/bin/bitcoind 

also gehe Ich:

$ sudo crontab -e @reboot /usr/bin/bitcoind 2>&1 >/tmp/bitcoind.out & 

Dann speichern und beenden Sie die Datei. crontab benachrichtigt mich:

crontab: installing new crontab 

Dann starte ich neu:

$ sudo shutdown -r 0 

Wenn ich jedoch wieder hochfahre, läuft das Skript nicht:

$ ps aux | grep bitcoind # *blank* 

Ich sehe diesen Eintrag jedoch in /var/log/syslog:

Dec 15 22:25:02 mypcname /USR/SBIN/CRON[2886]: (root) CMD (/usr/bin/bitcoind 2>&1 >/tmp/bitcoind.out &) 

Irgendwelche Ideen, warum das nicht funktioniert?

0
Interessant in der Datei `/ tmp / bitcoind.out`? Braiam vor 10 Jahren 0
Nee. es ist leer. Ich denke, das Problem wäre bei jeder ausführbaren Datei das gleiche. Ich werde das testen ... mulllhausen vor 10 Jahren 0

1 Antwort auf die Frage

0
mulllhausen

es stellte sich heraus, dass das problem mit bitcoind nicht cron war. Ich hatte Bitcoind nicht so konfiguriert, dass es als Root ausgeführt wird, also wurde es beim Booten bombardiert. Ich bin mir nicht sicher warum, aber die Würfel-Nachricht wurde nicht angezeigt /tmp/bitcoind.out. Als ich es gerade aus der Kommandozeile bitcoindals root ausprobierte, bekam ich:

$ sudo bitcoind Error: To use bitcoind, you must set a rpcpassword in the configuration file: /root/.bitcoin/bitcoin.conf It is recommended you use the following random password: rpcuser=bitcoinrpc rpcpassword=xxxxxxxxxxxxxxxxxxxxxxxxx (you do not need to remember this password) The username and password MUST NOT be the same. If the file does not exist, create it with owner-readable-only file permissions. It is also recommended to set alertnotify so you are notified of problems; for example: alertnotify=echo %s | mail -s "Bitcoin Alert" admin@foo.com 

also habe ich es behoben, indem ich bitcoind als benutzer ausgeführt habe:

$ sudo crontab -e # note that this is still root's crontab! @reboot sudo -u myusername /usr/bin/bitcoind 2>&1 >/tmp/bitcoind.cron-out 

und jetzt läuft es beim booten. Vielleicht wäre es besser gewesen, dies in meine eigene Crontab zu legen. Ich bin mir nicht sicher, ob dies bedeutet, dass es nur läuft, wenn ich mich als Benutzer durchlogge? Ich werde es später noch einmal testen und die Antwort aktualisieren, wenn das funktioniert ...

aktualisieren

Ja, es wird immer noch ausgeführt, auch wenn ich mich nicht anmelde, wenn ich den Eintrag aus der crontab-Datei von root lösche und ihn dann der crontab meines Benutzers hinzufüge:

$ sudo crontab -e # note that this is still root's crontab! <delete last line/> <save and exit/> crontab: installing new crontab $ crontab -e @reboot /usr/bin/bitcoind 2>&1 >/tmp/bitcoind.cron-out crontab: installing new crontab