Your Ad Here

Sabtu, 08 September 2012

Unix Tip: ACCIDENTS WITH CRONTAB

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 3500 - September 8, 2012

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@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@ugu.com - Copyright 1994-2001
==========================================================================

Tidak ada komentar:

Posting Komentar

Your Ad Here
Free Automatic Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink