Hi all Me again. I am new to learning how things like cron etc work in Linux (as opposed to AT etc in NT environments). My understanding is, you put a line into the /etc/crontab file and the system automatically reads that file once per minute. Now, I want to run a script at, say, 14h30, so I put in my /etc/crontab file: 30 14 * * * root /usr/bin/perl /home/default/scriptname.pl some_argument Is this correct? Well, I know it's not correct, because I did that a few minutes ago (different time :-)) and at the appointed time, nothing happened. Basically, I want to know how to tell the system to run a specific perl script at a certain time, and to accept a command line argument. How can I do this? Cheers Evan Morris evan@exclusivebooks.com +27 11 792 2777 (tel) +27 11 792 2711 (fax)
In a previous message, Evan Morris wrote:
30 14 * * * root /usr/bin/perl /home/default/scriptname.pl some_argument [snip] Basically, I want to know how to tell the system to run a specific perl script at a certain time, and to accept a command line argument.
The first thing is to ensure that you have the command format correct - that is, if you type it into a console, does it do what you want? Once you have that format, just transfer the command into your crontab. The time/date and user fields are correct in the example you gave AFAIK. If you want easier control of cron jobs, try webmin - it has a module for crons that makes it easier to manage. I discovered this tool recently and it's fantastic, with modules for configuring loads of different aspects of your system. HTH John -- John Pettigrew Headstrong Games john@headstrong-games.co.uk Fun : Strategy : Price http://www.headstrong-games.co.uk/ Board games that won't break the bank Knossos: escape the ever-changing labyrinth before the Minotaur catches you!
On Wed, Apr 09, 2003 at 02:10:06PM +0200, Evan Morris wrote:
My understanding is, you put a line into the /etc/crontab file and the system automatically reads that file once per minute.
Now, I want to run a script at, say, 14h30, so I put in my /etc/crontab file:
30 14 * * * root /usr/bin/perl /home/default/scriptname.pl some_argument
Is this correct?
Well, I know it's not correct, because I did that a few minutes ago (different time :-)) and at the appointed time, nothing happened.
o What does syslog say happened when the event kicked off? o Did you get emailed with an error message regarding the event? o What information did that message include? -- Brad Shelton On Line Exchange http://ole.net Phone: 313-526-1111 Fax: 313-526-3333
30 14 * * * root /usr/bin/perl /home/default/scriptname.pl some_argument
What if you remove "root" from the command? I'm not sure why it is there in the first place. Without rereading man 5 crontab I can only guess that you want to run the script as root? If so, put the entry in root's crontab or use su, sudo, or something of the sort. -- John LeMay KC2KTH Senior Enterprise Consultant NJMC | http://www.njmc.com | Phone 732-557-4848 Specializing in Microsoft and Unix based solutions
The 03.04.09 at 10:40, John LeMay wrote:
30 14 * * * root /usr/bin/perl /home/default/scriptname.pl some_argument
What if you remove "root" from the command? I'm not sure why it is there in the first place.
Because he is using the system crontab file, ie, "/etc/crontab", it's different from a user crontab file. -- Cheers, Carlos Robinson
participants (5)
-
Brad Shelton
-
Carlos E. R.
-
evan@exclusivebooks.com
-
John LeMay
-
John Pettigrew