LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
Search this Thread
Old 02-29-2008, 09:44 AM   #1
Jykke
Member
 
Registered: Sep 2005
Posts: 166

Rep: Reputation: 16
Somehow not getting crontab entry right


I am trying to make crontab to execute a shell script every
30 min between 8-17 o'clock and from Monday to Friday.
So I wrote this:

# m h dom mon dow command
30 8-17 * * 0-4 /home/user/script.sh

I am wondering what I am doing wrong...
 
Old 02-29-2008, 10:12 AM   #2
rayfordj
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 475

Rep: Reputation: 73
i think this should do it...

Code:
*/30 8-17 * * 1-5 /home/user/script.sh
you may review man 5 crontab for other acceptable variations.

may want to check the user's or root's mail to see if cron is reporting any errors.


edit: in your example 30 8-17 * * 0-4 /home/user/script.sh
it runs every day of the month (*) for every month (*) as long as it is Sunday-Thursday (0-4) between the hours of 8am-5pm (8-17) and the minutes is 30 (30)

so Monday at 8:30, 9:30, 10:30, ...

Last edited by rayfordj; 02-29-2008 at 10:16 AM. Reason: explain your example
 
Old 02-29-2008, 10:17 AM   #3
Jykke
Member
 
Registered: Sep 2005
Posts: 166

Original Poster
Rep: Reputation: 16
Hmm */30 means every thirty minutes, the way I had it should have been
correct for every xx:30 hours 12:30 13:30 or so. Maybe it was the day
formulation 0-4? Today is Friday - so it might have fallen off?

Thanks anyway I'll try that...
 
Old 02-29-2008, 10:20 AM   #4
rayfordj
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 475

Rep: Reputation: 73
Quote:
Originally Posted by Jykke View Post
Hmm */30 means every thirty minutes, the way I had it should have been
correct for every xx:30 hours 12:30 13:30 or so. Maybe it was the day
formulation 0-4? Today is Friday - so it might have fallen off?

Thanks anyway I'll try that...

correct, today being friday (5) the script would not run from cron.

maybe i misread what you meant by "I am trying to make crontab to execute a shell script every
30 min between 8-17". If you only want it to run at the xx:30 then your way is accurate. otherwise if you want it to run every 30 minutes xx:00 and xx:30, then either 0,30 or */30 should do it.
 
Old 02-29-2008, 01:50 PM   #5
Jykke
Member
 
Registered: Sep 2005
Posts: 166

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by rayfordj View Post
correct, today being friday (5) the script would not run from cron.

maybe i misread what you meant by "I am trying to make crontab to execute a shell script every
30 min between 8-17". If you only want it to run at the xx:30 then your way is accurate. otherwise if you want it to run every 30 minutes xx:00 and xx:30, then either 0,30 or */30 should do it.
Ah, yes, of course you're right. Anyway changed the day entry and it was running ok, thanks a lot!
 
  


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
Crontab entry doubt paventhan Solaris / OpenSolaris 1 11-03-2007 05:33 AM
crontab entry? Master Fox Linux - Software 4 08-23-2005 01:20 PM
crontab job entry notolerance Linux - Software 2 02-20-2005 02:40 PM
cronjob entry in crontab rockwell_001 Linux - General 2 06-30-2004 02:59 PM
crontab entry pilipk01 Linux - General 4 11-19-2003 07:53 PM


All times are GMT -5. The time now is 03:18 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration