Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
I'm trying to restart transmission using cron on specific times of the week. I have created a shell script which simply calls /ffp/start/transmission.sh restart. The script stops transmission but it doesn't start again.
I've looked at a similar thread and tried changing the shell path in the script but nothing seems to help. Thread here - http://dns323.kood.org/forum/viewtopic.php?id=2439
Here is what I've got:
Cron
* 22 * * 1,4 /ffp/sbin/transrestart.sh
Transrestart.sh
-rwxrwxrwx 1 root root 258 Nov 13 19:59 /ffp/sbin/transrestart.sh
#!/ffp/bin/sh /mnt/HD_a2/ffp/start/transmission.sh restart > /mnt/HD_a2/.transmission-daemon/cron.log
Have also tried
#!/bin/sh /mnt/HD_a2/ffp/start/transmission.sh restart > /mnt/HD_a2/.transmission-daemon/cron.log
ENV logged in as root
INPUTRC=/ffp/etc/inputrc SSH_CLIENT=192.168.0.4 55601 22 MAIL=/var/mail/root USER=root OLDPWD=/home/root LESS=-M HOME=/home/root SSH_TTY=/dev/pts/0 PS1=\u@\h:\w\$ PS2=> LOGNAME=root TERM=xterm PATH=/ffp/sbin:/usr/sbin:/sbin:/ffp/bin:/usr/bin:/bin LANG=en_US SHELL=/ffp/bin/sh PWD=/mnt/HD_a2/.transmission-daemon
Any help would be great.
Offline
No one?
Offline
Magnazan, when you are logged into a shell as root, your PATH is set to include /ffp, but when cron is running it's path doesn't include /ffp
you will need to set the full path manually in your script to include /ffp otherwise transmission can't find the other programs it need to start running
You SHOULD be able to set the PATH in the crontab entry, but when I tried this it still only showed PATH as
PATH='/usr/bin:/bin:/usr/sbin:/sbin'
so you'll have to set the PATH in your script.
I ran into your same problem when I tried restarting transmission every 5 days after I download an updated blocklist file, I just put the full path inside the transmission.sh script (same with any other scripts I call from cron)
just put
export PATH=/ffp/sbin:/ffp/bin:/usr/sbin:/sbin:/usr/bin:/bin
into your transmission start script and you should be good.
P.S
* 22 * * 1,4 /ffp/sbin/transrestart.sh
will cause your transmission to restart EVERY minute of hour 22....I don't think you want that, specify a minute as well
Here's what I use to update my blocklist and restart transmission (after I put the full PATH in my transmission.sh )
43 0 */5 * * /ffp/bin/wget --quiet --output-document - http://update.transmissionbt.com/level1.gz | /ffp/bin/gunzip -f > /mnt/HD_a2/.transmission-daemon/blocklists/level1 && /ffp/start/transmission.sh restart
I'm not sure how often the blocklist gets updates, but I figure every 5 days or so should be enough.
Good luck, and if in the future something doesn't work in cron but works when your logged in, now you'll know why.
P.P.S.
If you want to see what cron's ENV is, put this in your crontab for a minute or so
* * * * * env > /tmp/cron-env.txt
then cat /tmp/cron-env.txt, you'll see that your PATH doesn't have /ffp
Last edited by Mike H (2009-11-28 03:20:35)
Offline