use crontab for a shell script..

hi,

i have shell script which checks for service running on platform,
if service is receiving calls, then do nothing
if service is not receiving calls, then stop the service

i want to run this script in 2 timeslots.
i.e. in the day from 9 am to 5 pm it should run every 10 minutes

and
from 5 pm to next morning 9 am , it should run every 1 hour

can i schedule the running of script using crontab this way?

kindly provide inputs

thanks in advance

You can make two entries in crontab like this:

 
0,10,20,30,40,50 9-17 * * * job_script
 
0 17-9 * * * job_script

if u r in linux below is the entry
Condition 1
*/10 9-17 * * * script >>/var/log/cronrun Condition 2:
0 17-9 * * * script >>/var/log/cronrun
It redirects the log to /var/log/cronrun

For more info see the man crontab
minute (0-59),
hour (0-23),
day of the month (1-31),
month of the year (1-12),
day of the week (0-6 with 0=Sunday).