Another approach that is used quite often by menu-based admin
tools is to put a sentinel line before and after the required
line, and use them to allow you to find the job:
#<START>Daily Job
* * * * * /path/to/job
#<END>Daily job
Then its a matter of using a simple sed script:
/^#<START>Daily Job/,/^#<END>Daily Job/s/^/#/
turns it off
/^#<START>Daily Job/,/^#<END>Daily Job/s/^#//
turns it on
This is especially useful where there are a number of crontab
lines.
Adam
> I think you are saying that you want certain daily tasks
> to *not* be performed on specific dates. The way to
> do this would be to have cron start a "wrapper" script
> that checks the file of "skip" dates. Properly crafted,
> this script could accept the command that is currently
> in crontab as arguments so only one such script would
> be required, and uniform change could be made to all
> crontab entries at once.
> If you use a real return email address I will provide more
> specific details.
>> Hi all,
>> Just wondered if someone can help me out. I looking for a
>> script that would automatically place an entry such as a #
>> into the crontab to comment out a specific daily task from a
>> list of pre-defined dates.
>> What do you think?? Might be a pretty lengthly task... Oh
>> well...just thought I'd ask.
>> Thanks... Pete
>> * Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
> --
> Erik van Bronkhorst
> If you were a gladiator in olden days, I bet the inefficiency
> of how the gladiator fights were organized and scheduled
> would just drive you up a wall.
> -- Deep Thoughts, by Jack Handey
--
Saki Computer Services Pty Ltd| Purveyors of fine |
93 Kallista-Emerald Road | software | phone: +61 3 9752 1512
THE PATCH VIC 3792 AUSTRALIA| (including VersaFax) | fax: +61 3 9752 1098