> I have to admit that personally, I'm more concerned about jobs running
> twice than not at all. Your method helps people who go around and
> disable by hand the package rather than un-installing, but makes it
> worse for _everyone_ who has anacron installed and actually uses it.

> We can't keep going alont this way. What if someone modifies their
> crontab to not run cron.daily? That's going to cause breakage too. We
> have to decide a point past which it's not worth trying to fix the
> problems that are caused by the users disabling system tools.

You're right. Debian doesn't seem to provide any officially sanctioned way to 
disable startup services (like Red Hat's chkconfig). This being so, disabling 
services "by hand" should probably be considered "unsupported behavior": 
people who do it (like me) must suffer the consequences. (It would be nice if 
a future release of Debian supported this, thru a chkconfig-like program.)

For now, it would be better if cron could determine whether anacron is being 
started in the current runlevel, instead of relying on roundabout solutions 
like 'test -x /usr/sbin/anacron' or 'pidof anacron'. (It seems that trying to 
let cron be ignorant  of anacron won't work.) A possible solution would be 
the following /etc/crontab (though I hate relying on an external script):

-----CUT-----
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file.
# This file also has a username field, that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    run-parts --report /etc/cron.hourly
25 6    * * *   root    chkservice anacron || run-parts 
--report /etc/cron.daily
47 6    * * 7   root    chkservice anacron || run-parts 
--report /etc/cron.weekly
52 6    1 * *   root    chkservice anacron || run-parts 
--report /etc/cron.monthly
#
-----CUT-----

Where chkservice is a script like this:

-----CUT-----
#!/bin/sh
if [ -z "$1" -o "$1" = -h -o "$1" = --help ]; then
        echo "Usage: chkservice [SERVICENAME]"
        echo "Check whether a service will run in the current runlevel"
else
        runlevels=(`/sbin/runlevel`)
        current=${runlevels[1]}
        if [ -e "/etc/rc$current.d/S??$1" ]; then
                exit 0
        else
                exit  1
        fi
fi
-----CUT-----

Note: cron apparently makes empty environments for its children. If you could 
get the $RUNLEVEL env variable (mentioned by `man runlevel`) to be inherited, 
you could eliminate chkservice and just use lines like this:

25 6    * * *   root    test [ -e "/etc/rc$RUNLEVEL.d/S??anacron" || run-parts 
--report /etc/cron.daily

Summary: I understand why you have things the way they are. It's not perfect, 
but it may well be the best. (Standard disclaimers about non-ideal world 
apply.)

--
joel


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to