an init script that runs at boot but is ignored at poweroff, ugh. - Mandrake

This is a discussion on an init script that runs at boot but is ignored at poweroff, ugh. - Mandrake ; Mandriva 2007 is making me crazy still. I worked around the uncontrollable start/stop order of Mandriva 2007 init scripts by copying over chkconfig from Mandrake 10.1 (as mdk10.1_chkconfig.) I wrote up a script that uses this to --add or --del ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: an init script that runs at boot but is ignored at poweroff, ugh.

  1. an init script that runs at boot but is ignored at poweroff, ugh.

    Mandriva 2007 is making me crazy still.

    I worked around the uncontrollable start/stop order of Mandriva 2007
    init scripts by copying over chkconfig from Mandrake 10.1 (as
    mdk10.1_chkconfig.) I wrote up a script that uses this to --add or --del
    the /etc/rc.d/init.d entries and finally got them all into the
    /etc/rc.d/rc*.d directories with the numbers I wanted.

    Now the strange part, there is an "sge" script, which I've been using
    for years and years, and while it starts up properly, it is IGNORED
    on poweroff and shutdown. This leaves an sge_execd hanging around,
    and that blocks the final shutdown most of the time. Here are the
    first few lines of /etc/rc.d/init.d/sge

    #!/bin/sh
    # chkconfig: 345 95 10
    # description: Sun Grid Engine queuing system
    # processname: sge_qmaster
    # pidfile: /var/run/sge.pid
    # config: /usr/SGE/*
    # Source function library.
    .. /etc/rc.d/init.d/functions
    # Source networking configuration.
    .. /etc/sysconfig/network
    #
    echo DEBUG top of sge
    sleep 5

    So you can see it leaves a nice big message up so that there is plenty
    of time to see it. Yet I don't. Here are the rc links (and yes, they
    point to the right place):

    ../rc0.d/K10sge
    ../rc1.d/K10sge
    ../rc2.d/K10sge
    ../rc3.d/S95sge
    ../rc4.d/S95sge
    ../rc5.d/S95sge
    ../rc6.d/K10sge

    here are its ownership and protections:

    -rwxr--r-- 1 root root 16329 Feb 12 12:49 sge*

    Now when the system comes up it definitely runs this script, I see
    not only the DEBUG line but the normal "OK" sort of messages. It works
    as expected when run manually too, with:

    service sge start
    service sge stop

    However when the system shuts down, either with poweroff or reboot, the
    shutdown sequence ignores it. I see the ntpd messages, and then the
    xfs messages, but NOTHING from sge. There isn't even an empty line, it
    seems to be just ignored. (Keytable shutdown never emits
    anything, even if run manually.) The DEBUG line is never seen, let
    alone the ok echo. Here are the first few entries in /etc/rc.d/rc0.d:


    lrwxrwxrwx 1 root root 18 Feb 12 11:54 K05keytable -> ../init.d/keytable*
    lrwxrwxrwx 1 root root 14 Feb 12 11:54 K10ntpd -> ../init.d/ntpd*
    lrwxrwxrwx 1 root root 13 Feb 12 12:49 K10sge -> ../init.d/sge*
    lrwxrwxrwx 1 root root 13 Feb 12 11:54 K10xfs -> ../init.d/xfs*

    Can somebody please shed some light on this mystery?

    Thanks,

    David Mathog

  2. Re: an init script that runs at boot but is ignored at poweroff,ugh.

    David Mathog wrote:
    > Mandriva 2007 is making me crazy still.


    > Can somebody please shed some light on this mystery?


    Found it.

    /etc/rc.d/rc only does a "service whatever stop" if it finds
    a /var/lock/subsys/whatever file. If it doesn't find that lockfile
    it ignores K##whatever.

    Apparently this hasn't changed since Mandrake 10.1 What has changed is
    that Mandrake 10.1 could still poweroff or reboot if sge wasn't
    explicitly told to stop, whereas Mandriva 2007 hangs in killall5
    in the same situation.

    Regards,

    David Mathog

  3. Re: an init script that runs at boot but is ignored at poweroff,ugh.

    David Mathog schreef:
    > David Mathog wrote:
    >> Mandriva 2007 is making me crazy still.

    >
    >> Can somebody please shed some light on this mystery?

    >
    > Found it.
    >
    > /etc/rc.d/rc only does a "service whatever stop" if it finds
    > a /var/lock/subsys/whatever file. If it doesn't find that lockfile
    > it ignores K##whatever.
    >
    > Apparently this hasn't changed since Mandrake 10.1 What has changed is
    > that Mandrake 10.1 could still poweroff or reboot if sge wasn't
    > explicitly told to stop, whereas Mandriva 2007 hangs in killall5
    > in the same situation.
    >
    > Regards,
    >
    > David Mathog


    2007 uses LSB standard for init scripts. You need someting like this to
    make the scripts run in the correct order:

    ### BEGIN INIT INFO
    # Provides: mailboothalt
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Required-Start: $network postfix
    # Required-Stop: $network postfix
    # Short-Description: Send mail about startup/shutdown
    # Description: Mail users about computer startup/shutdown.
    ### END INIT INFO

    See also: http://www.novell.com/coolsolutions/feature/11256.html

    --
    Best regards, Max Heijndijk

    Photography - http://www.maccusfoto.nl
    Soundscapes - http://www.maccusfoto.nl/cchq
    Linux - http://www.maccusfoto.nl/conmen

  4. Re: an init script that runs at boot but is ignored at poweroff, ugh.

    On Tue, 13 Feb 2007 14:45:33 -0500, Maxim Heijndijk wrote:

    > 2007 uses LSB standard for init scripts. You need someting like this to
    > make the scripts run in the correct order:


    You missed the earliar part of this thread. He's already removed the LSB
    part of the script, which then causes the older format chkconfig lines to
    be used in the generation of the rc#.d/symlinks.

    He has the links in the correct place, but has found that /etc/rc.d/rc
    contains the lines ...
    [ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] \
    || continue
    which prevent the kill script from running, unless the lock file is found.

    Regards, Dave Hodgins

    --
    Change nomail.afraid.org to ody.ca to reply by email.
    (nomail.afraid.org has been set up specifically for
    use in usenet. Feel free to use it yourself.)

+ Reply to Thread