[Techtalk] crontab vs vi

Mandi mandi at linuxchick.org
Fri Jan 11 20:28:19 EST 2002



On Fri, 11 Jan 2002, gabrielle wrote:
....>
> Well...the guy who was helping me had a tizzy.  "Never use vi to edit
> that!  Always use crontab!"  I told him I'd always done it this way and
> never had any problems, and would he care to shed any light on his
> reasoning behind that statement, but he couldn't tell me.  He just said
> "You're not supposed to!"  I have since learned from another sysadmin
> friend that this may be the case for SCO, but it's certainly not an issue
> for linux or solaris.  However, he couldn't really tell me why either.
>


One thing I noticed just recently is that if you use crontab, it will
check if what you've entered is valid.  My mistake was to use "Thur"
instead of "Thu" in a day range, and it told me I had an invalid day.
This was on Red Hat 6.2.

However, as far as NOT using vi at all on some systems, I might speculate
that not all versions of cron on all systems go back and read the crontab
files on disk.  So, according to the cron man page, cron on linux reads
all crontabs at boot time, loads them into memory, and checks every minute
if anything is to run.  Then it checks the crontab files on disk.

So if you use crontab to edit your crontab file (again, on Linux), it
immediately re-reads your crontab file into memory.  This may not be the
case on all implementations.

The top paragraph of man crontab (for the command, not crontab(5), which
is the semantics of the file itself) has a remark that although the
crontab files are just flat files, they aren't really meant to be edited
with a normal editor.

I'm not familiar with the way things work on SCO, and I don't remember
solaris crontab much, but I figure if they went to the trouble of adding a
specific edit program for something, I prolly oughta use it.  ;)

HTH

--mandi




More information about the Techtalk mailing list