LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 10-09-2007, 07:56 PM   #1
xnomad
Member
 
Registered: Jun 2005
Posts: 53

Rep: Reputation: 15
Cron every 5 minutes but not between midnight and 1 am


Hi I've got a load alarm on one of our database servers.

Cron runs a script that checks the load every five minutes. If the load goes over 3 it sends me an sms text message.

*/5 * * * * /var/lib/pgsql/loadchk.sh


The database does a backup dump at midnight for about 20 minutes and the load occasionally goes up to 3 and I get woken up by my phone.

I would like cron not to run the script at this time. I tried the following:

*/5 1-0 * * * /var/lib/pgsql/loadchk.sh

but crontab didn't like this.

The following was accepted by crontab however, I'm not sure if it will work but it's also an hour too much:

*/5 1-23 * * * /var/lib/pgsql/loadchk.sh

Does anyone have any ideas?

Cheers,
 
Old 10-09-2007, 08:50 PM   #2
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,189

Rep: Reputation: 105Reputation: 105
Quote:
Originally Posted by xnomad View Post
The following was accepted by crontab however, I'm not sure if it will work but it's also an hour too much:

*/5 1-23 * * * /var/lib/pgsql/loadchk.sh
That looks good. Matches description in your title (once every 5 minutes but not between midnight to 1 am) and `man -s 5 crontab`.

What makes you think it's an hour too much?
 
Old 10-09-2007, 09:32 PM   #3
xnomad
Member
 
Registered: Jun 2005
Posts: 53

Original Poster
Rep: Reputation: 15
Hi,

Thanks,
Isn't it an hour too much? Is the 23 inclusive of an hour? I thought it would go to 23:05 and then stop.
 
Old 10-10-2007, 05:20 AM   #4
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,189

Rep: Reputation: 105Reputation: 105
nope. should go from 1:00, 1:05, 1:10, etc., through 22:55, 23:00, 23:05, 23:10, right through 23:55, and then stop until 1:00.

from 24:00 it won't run until 1:00, which is what your title asked for.
 
Old 10-11-2007, 01:41 AM   #5
xnomad
Member
 
Registered: Jun 2005
Posts: 53

Original Poster
Rep: Reputation: 15
Cool, thanks for that.
 
Old 10-11-2007, 12:17 PM   #6
JustinK101
Member
 
Registered: Jan 2007
Posts: 55

Rep: Reputation: 15
Exclamation

Do you think you could post the loadchk.sh file? I am interested in using that myself. Thanks.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting up cron to proccess a Bash Script to run every 15 minutes jamtech Programming 3 07-30-2007 03:32 PM
execute a script every 5 minutes "cron" ALInux Linux - General 1 02-10-2006 02:36 AM
howto run a script from cron every 5 minutes except 11pm-8am ? cccc Programming 2 03-20-2005 03:52 AM
Failed to lock file /var/spool/cron/root after 5 minutes teeno Linux - Software 0 09-24-2003 02:49 AM


All times are GMT -5. The time now is 12:25 AM.

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
Open Source Consulting | Domain Registration