Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to set a time to run a script

Status
Not open for further replies.

zhanghong920

Programmer
Nov 15, 2002
27
US
I'd like to check a file every 10 minutes. What command should I use to do that? Can I access the system clock?

Thanks a lot,

Hong
 
you can set up a cron job that will call your script to check the file. I am not sure what you are checking the files for, but the cron entry should look like

minute,hour,day of month, day of year, day of week, script

ex
0,10,20,30,40,50 * * * * /usr/bin/filechk.sh

This would execute the filechk.sh script every ten minutes
 
I do not mean for this to sound derogatory, but since it seems you are not very familiar with the cron, I would suggest reading the man pages first, you can get to them my typing “man cron”. Your basic cron commands are “cron –l” for listing the cron, and “cron –e” allows you to edit the cron. The functionality of actually editing the cron works the same as when you are editing your shell script. -B :cool:
birbone@earthlink.net
 
OOPS, big mistake....that should be "crontab" not cron. That'll teach me to be working on two things at one time. Also you will need to have root access in order to make changes to the cron. -B :cool:
birbone@earthlink.net
 
Every user can have cron jobs if permission was given by root.

regard Gregor Gregor.Weertman@mailcity.com
 
once again:
why not let your script decide to run or not ?
why should cron do it ?
put in cron, using crontab:
* * * * * /your/path/exec
and in /your/path/exec:

case 'date +%M' on *0) ;; *) exit 0;; esac
do the rest
exit 0
-----------
when they don't ask you anymore, where they are come from, and they don't tell you anymore, where they go ... you'r getting older !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top