Unable to start service within script file initiated by cron - Raspberry Pi Forums


i've noticed deluged has tendency crash interested in monitoring service , restarting if necessary via cron, can't work.

here's cron job:

code: select all

* * * * * /home/pi/scripts/deluged-watcher.sh
i've verified cron job firing , logic in script works intended (ie. if modify script write string file instead of line below see occur fine), critical line never works. here line initially:

code: select all

sudo service deluge-daemon restart &
realized sudo isn't allowed in script, service command requires root permissions. tried removing sudo line above , instead ran cron job root adding way:

code: select all

sudo crontab -e -u root
didn't work. found out cron not knowing paths, , tried modifications line of script such as:

code: select all

/usr/sbin/service deluge-daemon restart &
and

code: select all

 /etc/init.d/deluge-daemon restart &
neither worked. tried adding "sudo" cron job, though it's supposed running root:

code: select all

* * * * * sudo /home/pi/scripts/deluged-watcher.sh
not sure else try.

cron entries run root privileges. possible service restarting , crashing again?


raspberrypi



Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support