Click to See Complete Forum and Search --> : how to set cron


trashthing
03-25-2003, 08:10 PM
i'm wondering how to set cron to run a program every. ummm, like 10 minites. the program is a perl app i wrote. anyone know? :D

trashthing
03-25-2003, 08:27 PM
oops. i ment to say every 10 minites.

chrism01
03-26-2003, 07:30 AM
Try this
9 * * * * /home/your_script_name

fields are:
minute of hr 0-59
hour of day 0-23
day of mth 1-31
mth of year 1-12
weekday 0-6 (0=Sunday)

using crontab -e cmd to setup that entry.
Make sure you've got logging set in the script.

mdwatts
03-26-2003, 07:31 AM
Did you mean minutes? :)

The Scheduling in Linux (http://justlinux.com/nhf/Miscellaneous/Scheduling_in_Linux.html) JL Help File.

trashthing
03-26-2003, 05:22 PM
ehh, i put this in my user's crontab:

9 * * * * /home/user/path/file

but it doesn't work.

trashthing
03-26-2003, 08:48 PM
i think it's the permissions.

chrism01
03-27-2003, 06:49 AM
Could be; you'll need read+execute perms on the file for the user, and the user will need to be able to see perl itself.
Also, for every 10 mins, should be 0-59/10 (or */10) i think. My orig was on the 10th min of each hr. Sorry.

trashthing
03-27-2003, 04:37 PM
thanks, i got it to work. there is only one problem; when i run the app manually the program opens mozilla (that's what i want it to do), but when it runs in cron it doesn't open mozilla. is this a problem w/ cron or my program?

chrism01
03-28-2003, 01:26 PM
How do you know? Are you getting an error and if so what? Cron effectively runs in the background, so you're not going to see any output (or mozilla ;) ). What are you trying to do with this prog?

trashthing
03-29-2003, 09:01 PM
the program tells me when my IP changes. the way it tells me is it opens up a mozilla and says check my IP. i open mozilla w/ a system call.

chrism01
03-30-2003, 08:12 AM
As i said, cron runs (detached) in the background, so cannot communicate (directly) with a terminal.
You may have to settle for an email or call the wall cmd to braodcast a msg to all terminals.