A keystroke away from Doom.

William Weaver williamdweaver-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Fri Oct 18 17:51:15 UTC 2013


Keep in mind, if you just want to view the crontab without editing it.

# crontab -l

I feel it is safer to use functionality to view for viewing and
functionality for editing to edit. Ex. cat or less to view a file and vim
to edit.

Will Weaver


On Fri, Oct 18, 2013 at 1:43 PM, Christopher Browne <cbbrowne-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org>wrote:

> On Fri, Oct 18, 2013 at 1:32 PM, Scott Sullivan <scott-lxSQFCZeNF4 at public.gmane.org> wrote:
> > So, I just discovered crontab -r.
>
> Eek!!!  I didn't know that existed.
>
> One of my Standard Patterns in cfengine+Git is to run the following
> script...
>
> ---- snip bit of cfengine code.. ----
> shellcommands:
>     "$(GITHOME)/Scripts/savecrons.sh > /dev/null 2> /dev/null"
> ---- snip bit of cfengine code.. ----
>
> Voila "savecrons.sh"...
>
> #!/bin/bash
> CRONHOME=${HOME}/GitHome/InitFiles/cron
> pushd ${CRONHOME}
> CRONTABOUTPUT=`whoami`.`hostname`
> echo "Saving crontab to ${CRONTABOUTPUT}"
> crontab -l > ${CRONTABOUTPUT}
> git add ${CRONTABOUTPUT}
> git commit -m "Saving crontab for user ${USERNAME} on host ${HOST}"
> ${CRONTABOUTPUT}
> popd
>
> > Small things like this can make or break your day, and stresses that
> 'RAID'
> > is not a back-up, and the importance of having back-ups! Most of you know
> > this, but for those have forgotten or are new, just remember your a
> > keystroke away from doom.
>
> Back when I was DBA'ing in production, and didn't have Git in
> production areas, I had a similar script to "savecrons.sh" which
> would...
>  --> Dump current crontab into a fixed place...
>  --> See if that's the same as it was last time I ran the script
>  --> If not, then take one of the copies and give it a name based on
> today's timestamp
>
> That would give a history of whenever the crontab got messed with.
> Not as good as checking it into an SCM, but a *great* deal better than
> nothing...
>
> Having some reasonable sort of backup makes "crontab -r" a wildly less
> scary thing! :-)
> --
> The Toronto Linux Users Group.      Meetings: http://gtalug.org/
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/legacy/attachments/20131018/a65ab0c4/attachment.html>


More information about the Legacy mailing list