Re: cron on a system without a hardware persistant clock
David Goodenough <david.goodenough@btconnect.com> wrote:
> I could use update-rc.d to disable cron, and only enable it
> once wpa_supplicant has established the connection, but then
> what if the wireless link goes down and back up while the
> hardware is powered up, in which case it would get restarted
> unnecessarily.
I think you're almost there. What about disabling the start scripts for
cron in the /etc/rc*.d directories, and having your network-up trigger
"invoke-rc.d cron start". Don't have your network-down trigger the
corresponding cron stop, though.
On my debian system there isn't a "real" problem trying to start cron
multiple times (start-stop-daemon manages the process via its pid file):
$ ps -ef | grep [c]ron
root 3084 1 0 09:14 ? 00:00:00 /usr/sbin/cron
$ sudo invoke-rc.d cron start
Starting periodic command scheduler: cron failed!
$ sudo invoke-rc.d cron start
Starting periodic command scheduler: cron failed!
$ ps -ef | grep [c]ron
root 3084 1 0 09:14 ? 00:00:00 /usr/sbin/cron
If you're really keen, put a hook into the /etc/init.d/cron script that
exits unless the date/time is plausible. You can then call it at start,
at network-up, and maybe on other events. The same thing could work from
atd, too, if you have it in your environment.
Chris
Reply to: