DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2008-06-16 14:50:26

rx2
Member
Registered: 2008-06-08
Posts: 18

Starting & Stopping Transmission via Cron

Hi,

I want to be able to schedule my downloads so they only occur during the night and I thought a good idea would be to start and stop the transmission daemon via cron.

But like most scripting ventures, it is not working sad(((

I have edited editcron.sh in ffp/start - it looks like

#!/bin/sh
CRONTXT=/mnt/HD_a2/crontab.txt

# start with existing crontab
/bin/crontab -l > $CRONTXT

# start transmission daemon at 21:00
/bin/echo "00 21 * * *  /mnt/HD_a2/ffp/start/transmission.sh start > /mnt/HD_a2/.transmission/cron.log" >> $CRONTXT

#install the new crontab
/bin/crontab $CRONTXT

#clean up
/bin/rm $CRONTXT

The cron job kicks of at the right time but the daemon does not get started. The cron.log file contains the following indicating that the daemon never get started??

Starting transmission-daemon
Could not find Transmission socket

Not being an expert in linux scripting I am assuming it is failing somewhere in transmission.sh. Would anyone have an idea as to why it might be happening?

Thanks in advance for anyones help.

Cheers

Robert

Offline

 

#2 2008-06-16 15:13:50

index monkey
Member
From: UK
Registered: 2007-06-14
Posts: 112

Re: Starting & Stopping Transmission via Cron

you cold try getting the cron job to run a single script rather than sending "start" to transmission.sh in the cron job as follows:-

in editcron.sh:-
#start transmission daemon at 21:00
/bin/echo "00 21 * * * /mnt/HD_a2/ffp/bin/trans-start.sh" >> $CRONTXT

then in trans-start.sh :-
#!/bin/sh
/mnt/HD_a2/ffp/start/transmission.sh start > /mnt/HD_a2/.transmission/cron.log

For Testing, make sure of usual permissions issues, and try running the trans-start.sh to make sure it runs before incorporating it into the cron script.

Cheers.


DNS-323, HW B1, 2 x 2TB WD green, fw 1.08, fun_plug 0.5, transmission, automatic, nzbget newsreader & rsync time machine backup.

Offline

 

#3 2008-09-17 20:43:54

rocketfu
Member
Registered: 2008-08-07
Posts: 6

Re: Starting & Stopping Transmission via Cron

doing this works for me but it does not reload the blocklist file unless i log in and do a restart via
/ffp/start/transmission.sh restart while in root

when cron does it everything works after reviewing the log file i generated but there is no reloading of the level1 list.

Any ideas?

Thanks.

Last edited by rocketfu (2008-09-17 20:46:24)

Offline

 

#4 2008-09-17 22:12:51

rocketfu
Member
Registered: 2008-08-07
Posts: 6

Re: Starting & Stopping Transmission via Cron

I figured this out. I executed an "env" while logged in as root and did another one in the cronjob. The Path and shell settings were different. I changed the cronjob to change the path and shell settings to the ones in root then everything worked.

Last edited by rocketfu (2008-09-17 22:13:25)

Offline

 

#5 2009-01-02 12:50:15

ZeroFill
New member
Registered: 2008-12-29
Posts: 2

Re: Starting & Stopping Transmission via Cron

rocketfu wrote:

I figured this out. I executed an "env" while logged in as root and did another one in the cronjob. The Path and shell settings were different. I changed the cronjob to change the path and shell settings to the ones in root then everything worked.

Hi rocketfu,

Could you tell us what changes you did? I'm in the same boat as you -- wanting to have it start/stop on certain times of the day. I can see that the log is starting it but when I check the ps aux, it's not there. It works fine if ran from the commandline manually.

It seems like cron kills the job when it finishes so I tried adding a `&` at the end of the line so it continues to run in the background but that didn't seem to hep either.

Thanks!

Last edited by ZeroFill (2009-01-02 12:51:44)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB