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 2009-02-22 05:23:17

mordack
New member
Registered: 2009-02-22
Posts: 3

Cron Jobs on the DNS-343

Hi.

I am trying to setup a cron job to run a script which will watch a folder for transmission 1.50 for new torrent files and auto add them. 

I have tested the script by running it manually, and it works just fine.. however I cannot get the cron job to run to save my life..

I haven't used cron all that much, but by looking at information available on the web, I believe that I have it setup right..

How do I know if I am using the correct instance of crontab?  How can I verify that the crontab process is working nominally?  I don't see the process listed when I run top or run ps ax..

Here is the current entry in my cron file..

*    *    *    *    *   sh /ffp/start/torrentwatch.sh

Is that the correct syntax?  or is it only supposed to be one space instead of a tab between the asterisks?

I have been searching this and other forums all day, and I haven't found anything that can point me in the right direction, so I am hoping that someone here can.

Thanks!

Offline

 

#2 2009-02-22 10:10:56

RunaR
Member
Registered: 2008-08-14
Posts: 49

Re: Cron Jobs on the DNS-343

I have the line added as:
*/30 * * * * /ffp/var/scripts/torrentwatchdog.sh >> /mnt/USB/torrents/.torrentwd.log 2>&1

It runs every 30 minutes. sh is not needed. output goes to a log file. The exacutable bit on the script should be on (chmod a+x <filename>). /ffp/start is not the ideal place to put the file. The script will also run at startup.

Last edited by RunaR (2009-02-22 10:12:55)

Offline

 

#3 2009-02-22 12:37:01

silversurfer
Member
Registered: 2008-07-20
Posts: 95

Re: Cron Jobs on the DNS-343

mordack wrote:

Hi.
Here is the current entry in my cron file..

*    *    *    *    *   sh /ffp/start/torrentwatch.sh

Is that the correct syntax?  or is it only supposed to be one space instead of a tab between the asterisks?

You need to specify a bit more than that unless you want to run the script every minute. Have a look at the Wiki for example -> http://en.wikipedia.org/wiki/Cron#Fields
As RunaR already stated "*/30 * * * * /ffp/start/torrentwatch.sh" will be ok to run the script every 30 minutes on your machine. One space between the asterisks is sufficient but tabs should work as well.

Use "crontab -l" to check if the job was successfully added to the crons task list.

It would also be a good idea to specify a log file so you can see when the script was run and what it did.

Last edited by silversurfer (2009-02-27 18:28:55)

Offline

 

#4 2009-02-22 19:43:17

toolbox
Member
Registered: 2008-12-18
Posts: 83

Re: Cron Jobs on the DNS-343

If all you want is to automate transmission, take a look of http://dns323.kood.org/forum/t2664-Tran … ript..html

Offline

 

#5 2009-02-24 20:28:26

mordack
New member
Registered: 2009-02-22
Posts: 3

Re: Cron Jobs on the DNS-343

RunaR wrote:

I have the line added as:
*/30 * * * * /ffp/var/scripts/torrentwatchdog.sh >> /mnt/USB/torrents/.torrentwd.log 2>&1

It runs every 30 minutes. sh is not needed. output goes to a log file. The exacutable bit on the script should be on (chmod a+x <filename>). /ffp/start is not the ideal place to put the file. The script will also run at startup.

the other thing i was wondering, was which crontab is being run?  the one included with the ffp script? or the one that is included on the dns box itself?  I looked and saw 2 folders with that command, pointing to two different busybox executables..   how do I verify which one is running the job? and does it make a difference?


does the */30 at the beginning of the crontab line make it every 30 mins?  therefore if i make it */5 it will run every 5 mins? 

I have used linux quite a bit, but never have had to run jobs using cron, so i kinda on a beginner level in that regard.. smile

thanks!

Offline

 

#6 2009-02-24 21:22:32

RunaR
Member
Registered: 2008-08-14
Posts: 49

Re: Cron Jobs on the DNS-343

I can't answer your first question, but it seems to work nonetheless.

*/30 means the job will run every 30 minutes. */5 will indeed make it run every 5 minutes. When you put just a "5" in that position it will only run on 5 minutes past the whole hour.

Offline

 

#7 2009-02-25 17:38:06

mordack
New member
Registered: 2009-02-22
Posts: 3

Re: Cron Jobs on the DNS-343

Thanks for your help, that seems to have done the trick!

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB