Linux - Server This forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to
LinuxQuestions.org , a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free.
Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please
contact us . If you need to reset your password,
click here .
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
10-09-2007, 07:56 PM
#1
Member
Registered: Jun 2005
Posts: 53
Rep:
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,
10-09-2007, 08:50 PM
#2
Senior Member
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,189
Rep:
Quote:
Originally Posted by
xnomad
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?
10-09-2007, 09:32 PM
#3
Member
Registered: Jun 2005
Posts: 53
Original Poster
Rep:
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.
10-10-2007, 05:20 AM
#4
Senior Member
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,189
Rep:
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.
10-11-2007, 01:41 AM
#5
Member
Registered: Jun 2005
Posts: 53
Original Poster
Rep:
Cool, thanks for that.
10-11-2007, 12:17 PM
#6
Member
Registered: Jan 2007
Posts: 55
Rep:
Do you think you could post the loadchk.sh file? I am interested in using that myself. Thanks.
Thread Tools
Search this Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT -5. The time now is 12:25 AM .
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know .
Latest Threads
LQ News