Cron job questions
Kevin D. Kinsey, DaleCo, S.P.
kdk at daleco.biz
Fri Mar 12 07:44:31 PST 2004
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
More information about the freebsd-questions
mailing list