commenting out crontab entries

commenting out crontab entries

Post by Pete » Tue, 02 May 2000 04:00:00



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

 
 
 

commenting out crontab entries

Post by Barry Margoli » Tue, 02 May 2000 04:00:00




>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.

The following will comment out any lines that contain the word "task":

crontab -l | sed '/task/s/^/#/' | crontab

Someone once posted that some versions of crontab can't deal with both
reading and writing in the same pipeline (perhaps due to locking the
crontab file).  In that case you'll need a temp file:

crontab -l > $TEMPFILE
sed '/task/s/^/#/' $TEMPFILE | crontab
rm $TEMPFILE

--

Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

commenting out crontab entries

Post by Erik van Bronkhors » Tue, 02 May 2000 04:00:00


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

 
 
 

commenting out crontab entries

Post by a.. » Wed, 03 May 2000 04:00:00


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
 
 
 

1. crontab entries generate error message; problem with ownership of crontab file?

Hello:

For each line in my crontab file I get the following error message

        limit: coredumpsize: Can't set limit

and the entry doesn't execute.  

This happens to my user account's crontab, but not to root's.  Somehow
cron doesn't understand the command 'limit coredumpsize 1000000' in
/etc/csh.cshrc under these circumstances.

I've disovered that the problem goes away if I change the owner of
/var/spool/cron/alan to alan.alan instead of root.alan but eventually
ownership reverts back to root.alan.  Presumably cron is changing
ownership for security reasons(?).  I need more documentation on how
crontab works vis-vis crontab file ownership/permission.  Everything
worked fine for months until a few weeks ago.  Some package I updated?

FWIW:  Linux 2.0.35 (Red Hat 5.1)


Thanks much,
--Alan Vlach

2. Enterprise Management Theater

3. Yacc entry for crontab , accepting negative entry how ?

4. Strange problem with forks while trying to run C News

5. In and outs of crontab

6. SCO Systems Admin / Mpls,MN / Manufacturing / networking / $$ DOQ / UNIX / excellent benefits

7. Comments in /usr/lib/crontab

8. HELP on monitor specs

9. Can I put # comments # in my crontab file?

10. Comments in /usr/lib/crontab

11. What permissions should a script have for a crontab entry to

12. Q: How to suppress syslog entry in crontab?

13. crontab entries for pseudo-users