Re: [ILUG] Crontab

From: Kenn Humborg (kenn at domain linux.ie)
Date: Wed 09 Feb 2000 - 20:35:14 GMT


On Wed, Feb 09, 2000 at 07:39:44PM +0000, ray at domain phbrink.ie wrote:
> On Wed, 9 Feb 2000, Johno Sullivan wrote:
>
> |did you use "crontab -e" or "vi /etc/crontab"?
>
> This is going to depend on which distro you're using ?
> if one doesn't work try the other :)

The crontab command edits the files in /var/spool/cron,
not /etc/crontab.

> |On Wed, 9 Feb 2000 dollar at domain skynet.ie wrote:
> |
> |>I put this in my /etc/crontab:
> |>
> |>#switch internet on at:
> |>40 18 * * 1-5 /usr/sbin/ppp-go <--- This brings up ppp0
>
> try replacing it with the following so that the system knows who to run it
> as for example
> 40 18 * * 1-5 root /usr/sbin/ppp-go

That should solve it. The /etc/crontab (and also files in /etc/cron.d
with newer versions of vixie-cron) must include a username in the 6th
field to specify the user to run the command as.

Incidentally, I recommend putting site-specific entries in files
in /etc/cron.d, and leave the main /etc/crontab as supplied by your
distribution. Files in /etc/cron.d have the same format as
/etc/crontab. (You might need to duplicate the VAR= lines from
the top of /etc/crontab.) Note that this is very different from
the scripts (or symlinks) that are put in /etc/cron.{hourly,daily...}

> |>#switch internet off at:
> |>50 18 * * 1-5 killall pppd
> add a user for it to run as, also this could break if a path isn't
> declared b4hand, a good rule of thumb (IMHO) is to put absolute paths into
> crontabs.

Seconded. Your $PATH is probably shorter than you'd expect under crond.
Just put in an entry to run /usr/bin/env and you'll get the cron environment
mailed to you.

> |>
> |>Then ran
> |>
> |>/etc/rc.d/init.d/crond restart

No need to restart crond after changing a crontab. crond reloads the
crontab automatically if it is modified.

Later,
Kenn



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:05:23 GMT