LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-16-2007, 12:03 AM   #1
chnlinux
LQ Newbie
 
Registered: Jun 2007
Posts: 28

Rep: Reputation: 15
Scheduling Cron Job


Hi ,

I want the cron job to run for every four hours on daily basis.Please help me in how to setup in the crontab

Thanks/Chn
 
Old 10-16-2007, 12:09 AM   #2
tajamari
Member
 
Registered: Jul 2007
Distribution: Red Hat CentOS Ubuntu FreeBSD OpenSuSe
Posts: 252

Rep: Reputation: 30
0 * * * * yourscript

create it as a text file if you want to save it. then run crontab yourfile.txt
 
Old 10-16-2007, 12:22 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
See here: http://www.adminschoice.com/docs/cro...Crontab%20file
 
Old 10-16-2007, 12:37 AM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by tajamari View Post
0 * * * * yourscript

create it as a text file if you want to save it. then run crontab yourfile.txt
That's wrong. This will run the job every hour on the hour.

Code:
0 */4 * * * yourscript
would run it every 4 hours on the hour.



Cheers,
Tink
 
Old 10-16-2007, 12:37 AM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by chrism01 View Post
Congrats on your 2000th post ;}



Cheers,
Tink
 
Old 10-16-2007, 05:51 AM   #6
tajamari
Member
 
Registered: Jul 2007
Distribution: Red Hat CentOS Ubuntu FreeBSD OpenSuSe
Posts: 252

Rep: Reputation: 30
Quote:
Originally Posted by Tinkster View Post
That's wrong. This will run the job every hour on the hour.

Code:
0 */4 * * * yourscript
would run it every 4 hours on the hour.



Cheers,
Tink
sorry tink i overlooked the "four" hihihi
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Scheduling a CRON job to run on the first Sunday of the month New2Linux2 Linux - Software 10 11-08-2016 01:25 PM
LXer: Linux tip: Job scheduling with cron and at LXer Syndicated Linux News 0 07-21-2007 04:16 AM
LXer: Java Job scheduling with Quartz LXer Syndicated Linux News 0 11-28-2006 09:21 AM
scheduling poweroff using cron akudewan Ubuntu 2 11-17-2005 05:00 AM
scheduling monthly job in cron from debian sarge 3.1 sridhar11 Debian 2 10-28-2005 10:03 AM


All times are GMT -5. The time now is 01:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration