Results 1 to 8 of 8
I have the below crontab job that it will run at every 7:00am - 10:00am , it work fine , now if I want to skip to run the crontab ...
- 03-22-2005 #1Just Joined!
- Join Date
- Feb 2005
- Posts
- 77
Run cron job problem
I have the below crontab job that it will run at every 7:00am - 10:00am , it work fine , now if I want to skip to run the crontab job at a specific time , eg. I want the script not to run at next Monday 8:00am ( only skip this time , other time is normal ) , how can I make it ? is it possible ? thx in advance .
00 7-10 * * * script
- 03-22-2005 #2Linux User
- Join Date
- Feb 2005
- Posts
- 290
use at command to instruct your server to stop crond one minute before next Monday 8:00am and restart crond at 8:01am, or make your script to kill itself if it is "Monday 8:00am"
good luck
- 03-22-2005 #3Just Joined!
- Join Date
- Feb 2005
- Posts
- 77
thx reply ,
but if do so , the other process also can't run at Monday 08:00 , I think it is not suit to my case as we have many cronjob that that time , is there other advice ? thx
- 03-22-2005 #4Linux Enthusiast
- Join Date
- Feb 2005
- Location
- SE, Stockholm
- Posts
- 512
Your crontab should look like something like this
The time columns is:Code:0 7-10 * * 0,2,3,4,5,6,7 script
Minutes 0-59
Hours 0-23
Day of month 1-31
Month 1-12
Day of week 0-6 (0 == Sunday by default)
- 03-22-2005 #5Linux User
- Join Date
- Feb 2005
- Posts
- 290
then it will do nothing on every monday !
Originally Posted by swemic
try this at the beginning of your script:
excuse me for my bad scripting, but that should give you some ideas, you might want to check for date as wellCode:#!/bin/sh day=`date | awk '{print $1}'` time=`date | awk '{print substr($4,0,2)}'` echo $time if [ $day = "Mon" ]; then if [$time = "08" ]; then exit fi fi
good luck
- 03-22-2005 #6Linux Enthusiast
- Join Date
- Feb 2005
- Location
- SE, Stockholm
- Posts
- 512
And that's exactly whats wanted, right? It was just this particular script that was not supposed to be started each monday,then it will do nothing on every monday !
This crontab will run script1 every day at 1:00 am,Code:0 1 * * * script1 0 2 * * 0,2,4 script2
and script2 every Sun, Tue, Thu at 2:00 am.
Just to fast I was, saw a flaw in my prev example,
should have been:
The last 7 would be erreneousCode:0 7-10 * * 0,2,3,4,5,6 script
- 03-22-2005 #7Linux User
- Join Date
- Feb 2005
- Posts
- 290
Re: Run cron job problem
my understanding is the cron should only skip next Monday's 8:00am, the rest of the Monday 8:00am is not included.... hmm....
Originally Posted by ust
whatever...
- 03-22-2005 #8Linux Enthusiast
- Join Date
- Feb 2005
- Location
- SE, Stockholm
- Posts
- 512
Could be, I might have missunderstand the context of the question.
Even so, there are a few solutions here now.


Reply With Quote
