[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Solved] Re: Problems with cron


Cron is now working. The problem was (is) what I consider to be a bug
which I'd call "Inconsistent behavior of crontab and cron with regard
to the newline character".

1. When using "crontab -e" to edit the user crontab file, crontab refuses
   to accept a newline character (pressing return) at the end of the last
   crontab entry. It complains saying something like "invalid minutes field".
   However this last line, without the linefeed, is parsed well and accepted
   as a valid entry by crontab.
2. On the other hand, Cron, the guy who actually does the job, requires
   a line feed at the end of each entry, otherwise it'll ignore whatever is
   written there!
So, at the end, that "valid" last entry that crontab accepted (and
enforced not to have a linefeed) is ignored by cron. I think this is
inconsistent; either both pieces require the linefeed or both ignore it.

In my case neither the user crontab file nor the /etc/crontab file were
working. My solution with the former was to write my single-line user
crontab file like this:

0 */6 * * * /usr/sbin/fetchmail 2>&1 >/dev/null

Note the hash (#) in the second line which is treated as a comment. This 
is ok with both crontab and cron.

My solution with /etc/crontab was just to add a linefeed at the end,
which I always do. When I decided to try /etc/crontab I had spent a few
hours already fighting with crontab trying to get it to accept the
linefeed in the user crontab file. It seems that I unconsciously
refrained from adding the linefeed to /etc/crontab :(

Thanks to all of you who tried to help.

Pedro I. Sanchez

TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .

Reply to: