Operating System - Linux
1752679 Members
5635 Online
108789 Solutions
New Discussion юеВ

Re: how to schedule cron jobs in linux

 
yogesh kumar_2
Frequent Advisor

how to schedule cron jobs in linux

Hi,

Can anyone tell me how to schedule cron jobs in linux(RedHat).
10 REPLIES 10
Ivan Krastev
Honored Contributor

Re: how to schedule cron jobs in linux

Use crontab:

crontab -e /edit/
crontab -l /list jobs/

see man crontab for examples.

regards,
ivan

Re: how to schedule cron jobs in linux

run the command
#crontab -l (listing the cron jobs)
#crontab -e
There will be six field
The last field be the script you want to execute.

#service crond start
#chkconf crond on
#chkconf crond --list this will be showing you on which run level cron services will be running.
Suraj K Sankari
Honored Contributor

Re: how to schedule cron jobs in linux

Hi,

crontab -l for listing
crontab -e for editing
crontab -r for removeing

these are the crontab fields
do crontab -l and set your program as per your plan

minute hour monthday month weekday command

0 0-23 0 * 0 /home/abc/systemchk.sh (full path of command/program name)

Means every hour this program will run

Suraj
Suraj K Sankari
Honored Contributor

Re: how to schedule cron jobs in linux

sorry some changes
do crontab -e it will open the crontab file
then edit as per your plan

Suraj
yogesh kumar_2
Frequent Advisor

Re: how to schedule cron jobs in linux

No i want to schedule night at 12 'o' clock.
what is the command?
James R. Ferguson
Acclaimed Contributor

Re: how to schedule cron jobs in linux

Hi Yogesh:

> Can anyone tell me how to schedule cron jobs in linux(RedHat).

Sure, ask the question in the LINUX forum!

http://forums11.itrc.hp.com/service/forums/familyhome.do?familyId=118

Regards!

...JRF...
Sandeep_Chaudhary
Trusted Contributor

Re: how to schedule cron jobs in linux

crontab -l #list cronjob entries
crontab -e #EDIT CRON JOB FILE

* 0 * * * /root/scripts/verify_ignite.sh >/dev/null 2>&1


this will run this script at night 12 0 clock.
yogesh kumar_2
Frequent Advisor

Re: how to schedule cron jobs in linux

hi i executed crontab -l nothing its showing.Please tell me in correct steps.

Patrick Wallek
Honored Contributor

Re: how to schedule cron jobs in linux

>>executed crontab -l nothing its >>showing.Please tell me in correct steps.

That could just mean that you have not scheduled any jobs yet. It does NOT mean something is wrong.

Use 'crontab -e' and add your job as numerous people above have said. You might also want to do a 'man crontab' and read throught it.

>>* 0 * * * /root/scripts/verify_ignite.sh >/dev/null 2>&1
>>this will run this script at night 12 0 clock.

And it will run it at 12:01, and 12:02, and 12:03, etc.....

The '*' in the first field means ALL MINUTES of the hour.

If you want the job to run at midnight every night, then:

0 0 * * * /dir/somejob.sh

will do it.