Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Mar 2004 09:44:25 -0600
From:      "Kevin D. Kinsey, DaleCo, S.P." <kdk@daleco.biz>
To:        Dave Carrera <dave@ephgroup.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Cron job questions
Message-ID:  <4051DAD9.7080306@daleco.biz>
In-Reply-To: <003301c40815$c94ba5d0$0301a8c0@daveslaptop>
References:  <003301c40815$c94ba5d0$0301a8c0@daveslaptop>

next in thread | previous in thread | raw e-mail | index | archive | help
Dave Carrera wrote:

>Hi Frank,
>
>So if I 
>
>#ee /etc/crontab (I prefer ee to vi )
>
>Add this
>
>*	2	*	*	*	root	/bin/csh /root/script.csh
>
>Save exit
>
>That should run my script at 2am every morning yes ?
>
>Spaces above are tabs in keeping with what is in my crontab already (entries
>by someone else's)
>
>Thanks for your help
>
>Dave C
>
>  
>

At the risk of making you hate my
name in your inbox ... no, no, no,
please? :-)  You should use "crontab -e"
as someone already noted.

If you prefer ee to vi (I don't vi, either),
then your environment should specify
this, so that "crontab -e" puts you in an
ee session on */var/cron/tabs/root* instead
of a vi session on the same file.  */etc/crontab*
is the *system* crontab, (that's why there
are "entries by someone else"), the format is
different, and doing this is the cause of
one of the FAQ errors on this list (something
to the effect of "why does cron mail me saying
"root:  not found") .....

To set ee as your EDITOR in csh/tcsh:

$setenv EDITOR ee

     note that this will only last as long as
your login session, so you will actually want
to put this line in your $HOMEDIR/.cshrc so
it will be part of your environment every time
you log in.

In sh/bash, etc.:

$EDITOR=ee  && export EDITOR

You should also place these lines
(probably seperately instead of w/'&&'
as I showed you) in your .shrc, .bashrc,
.login or .profile....

This is best practice, because this
environment variable is not only used
with "crontab -e", but also with "vipw",
"visudo" (if installed), etc., etc., etc....

HTH,

Kevin Kinsey
DaleCo, S.P.

PS> for crontab syntax:
    $man 5 crontab

Here's a short teaser

#min    hour    day     mon     weekday         command
*/5         *           *           *           *               
/usr/bin/php -q /home/me/scripts/move.php > /dev/null 2>&1

@reboot                                 /usr/sbin/ndc start



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4051DAD9.7080306>