Unix Tip: ACCIDENTS WITH CRONTAB

Lucas Peet lpeet at eccod.com
Fri Aug 30 18:38:51 CDT 2002


Thought this might be relevant what with the cron questions floating
around...

-Lucas

----- Original Message -----
From: "Unix Guru Universe" <listserv at ugu.com>
To: <lpeet at eccod.com>
Sent: Friday, August 30, 2002 12:44 PM
Subject: Unix Tip: ACCIDENTS WITH CRONTAB

>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>       UNIX GURU UNIVERSE
>          UNIX HOT TIP
>
> Unix Tip 2068 - August 30, 2002
>
>     http://www.ugu.com/sui/ugu/show?tip.today
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>
> ACCIDENTS WITH CRONTAB
>
> Ever typed the crontab
> command and forgot
> the -l option?
>
> That's kinda dangerous,
> for if you hit ctrl-D
> to get back to the
> prompt, your crontab's
> gone.
>
> To prevent this, make a
> script with the following
> contents:
>
> #!/bin/ksh
> if [[ $# -eq 0 ]] ; then
>     echo "crontab: no option specified. Aborted."
>     exit 2
> else
>     /usr/bin/crontab "$@"
> fi
>
>
> Make sure the script is
> executable and put it in
> a directory that's in your
> PATH BEFORE the /usr/bin
> directory.
>
> Now if you type crontab
> without option or filename,
> you'll just get an error
> message. If you want to pipe
> some stuff to crontab, you
> still can do it like this:
>
> % somecommand | crontab -
>
>
> This tip generously supported by: kees.couprie+ugu at swift.com
>
>
> --------------------------------------------------------------------------
> To Subscribe:    http://www.ugu.com/sui/ugu/show?tip.subscribe
> To Unsubscribe:  http://www.ugu.com/sui/ugu/show?tip.unsubscribe
> To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today
>
> DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND ARE
> NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX
> GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU  ADVISES THAT
> ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.
>
> Unix Guru Universe - www.ugu.com - tips at ugu.com - Copyright 1994-2001
>
>




More information about the Kclug mailing list