Equivalent of rc.local but for shutdown? - Mandriva

This is a discussion on Equivalent of rc.local but for shutdown? - Mandriva ; Is there an equivalent for /etc/rc.d/rc.local but is run at shutdown, preferably very early in the shutdown sequence? My wife uses Timidity on one of our computers that gets shut down when not in use. She starts up the Timidity ...

+ Reply to Thread
Results 1 to 11 of 11

Thread: Equivalent of rc.local but for shutdown?

  1. Equivalent of rc.local but for shutdown?

    Is there an equivalent for /etc/rc.d/rc.local but is run at
    shutdown, preferably very early in the shutdown sequence?

    My wife uses Timidity on one of our computers that gets shut
    down when not in use. She starts up the Timidity server
    manually when she wants to use it. There's apparently a bug
    somewhere between the ALSA drivers and the init scripts and
    the kernel that prevents the system from shutting down if
    Timidity is still running when the system tries to shut
    down. Usually, the shutdown sequence hangs at the line that
    says it's shutting down the ALSA drivers, because some
    processes are still using the drivers. (Never mind that it
    looks like no attempt has been made to stop processes at
    that point...) The shutdown sequence is stopped dead in its
    tracks at that point. Rarely, it gets past shutting down
    the ALSA drivers but hangs after "Halting system" and before
    "stopping all md devices".

    If there were a convenient script or hook on which to hang a
    script, I could kill any Timidity processes and side-step
    the bug. (Yes, I filed the bug, and it has been triaged.)

    Thanks.

    --
    Robert Riches
    spamtrap42@verizon.net
    (Yes, that is one of my email addresses.)

  2. Re: Equivalent of rc.local but for shutdown?

    On Sun, 05 Oct 2008 00:58:42 -0400, Robert Riches wrote:

    > If there were a convenient script or hook on which to hang a
    > script, I could kill any Timidity processes and side-step
    > the bug. (Yes, I filed the bug, and it has been triaged.)


    Create a script in /etc/init.d/, that kills the process, with
    a filename such as akilltim. Add symlinks to it as
    /etc/rc.d/rc0.d/K00akilltim, and also as
    /etc/rc.d/rc6.d/K00akilltim.

    The rc0 entry will be executed on halt, and the rc6 entry on
    reboot. I haven't tested this, but think it will work.

    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.)

  3. Re: Equivalent of rc.local but for shutdown?

    On Sunday 05 October 2008 06:58, someone identifying as *Robert Riches*
    wrote in /alt.os.linux.mandriva:/

    > Is there an equivalent for /etc/rc.d/rc.local but is run at
    > shutdown, preferably very early in the shutdown sequence?
    >
    > My wife uses Timidity on one of our computers that gets shut
    > down when not in use. She starts up the Timidity server
    > manually when she wants to use it. There's apparently a bug
    > somewhere between the ALSA drivers and the init scripts and
    > the kernel that prevents the system from shutting down if
    > Timidity is still running when the system tries to shut
    > down. Usually, the shutdown sequence hangs at the line that
    > says it's shutting down the ALSA drivers, because some
    > processes are still using the drivers. (Never mind that it
    > looks like no attempt has been made to stop processes at
    > that point...) The shutdown sequence is stopped dead in its
    > tracks at that point. Rarely, it gets past shutting down
    > the ALSA drivers but hangs after "Halting system" and before
    > "stopping all md devices".
    >
    > If there were a convenient script or hook on which to hang a
    > script, I could kill any Timidity processes and side-step
    > the bug. (Yes, I filed the bug, and it has been triaged.)


    I don't know Timidity, but if your kernel supports forced module unloading,
    you can put that in an rc-type script and add an appropriate symlink to it
    to runlevels 0 and 6.

    Hope this helps... ;-)

    --
    *Aragorn*
    (registered GNU/Linux user #223157)

  4. Re: Equivalent of rc.local but for shutdown?

    Robert Riches wrote:

    > Is there an equivalent for /etc/rc.d/rc.local but is run at
    > shutdown, preferably very early in the shutdown sequence?
    >
    > My wife uses Timidity on one of our computers that gets shut
    > down when not in use. She starts up the Timidity server
    > manually when she wants to use it. There's apparently a bug
    > somewhere between the ALSA drivers and the init scripts and
    > the kernel that prevents the system from shutting down if
    > Timidity is still running when the system tries to shut
    > down. Usually, the shutdown sequence hangs at the line that
    > says it's shutting down the ALSA drivers, because some
    > processes are still using the drivers. (Never mind that it
    > looks like no attempt has been made to stop processes at
    > that point...) The shutdown sequence is stopped dead in its
    > tracks at that point. Rarely, it gets past shutting down
    > the ALSA drivers but hangs after "Halting system" and before
    > "stopping all md devices".
    >
    > If there were a convenient script or hook on which to hang a
    > script, I could kill any Timidity processes and side-step
    > the bug. (Yes, I filed the bug, and it has been triaged.)
    >
    > Thanks.
    >

    There is a script in your /home directory, .bash_logout.

    But what you need is the timidity-init package from the repositories. It
    sets up a service for timidity in /etc/init.d, which is shut down in the
    same way as all the others. That is what I use. It will start timidity
    as well, but it conflicts with pulse audio, and the startup fails. No
    problem in your case.

    Doug.
    --
    If you don't have a dream,
    How are you going to have a dream come true?
    - Oscar Hammerstein II.


  5. Re: Equivalent of rc.local but for shutdown?

    Doug Laidlaw wrote:

    > There is a script in your /home directory, .bash_logout.
    >

    But of course, that is useless for shutting down a program started by root.

    Doug.
    --
    Science is organized knowledge. Wisdom is organized life.
    - Immanuel Kant


  6. Re: Equivalent of rc.local but for shutdown?

    Robert Riches wrote:

    >... Usually, the shutdown sequence hangs at the line that
    >says it's shutting down the ALSA drivers, because some
    >processes are still using the drivers.


    A simple (albeit inelegant) fix is not to shut down ALSA -- remove
    K70alsa from rc0.d, rc1.d and rc6.d

    This doesn't stop the drives unmounting which is the important thing, so
    the PC should then shut down and power-off just fine.

    --
    Dave Farrance

  7. Re: Equivalent of rc.local but for shutdown?

    On Sun, 05 Oct 2008 02:46:03 -0400, David W. Hodgins wrote:
    >
    > Create a script in /etc/init.d/, that kills the process, with
    > a filename such as akilltim. Add symlinks to it as
    > /etc/rc.d/rc0.d/K00akilltim, and also as
    > /etc/rc.d/rc6.d/K00akilltim.
    >
    > The rc0 entry will be executed on halt, and the rc6 entry on
    > reboot. I haven't tested this, but think it will work.


    "Not sure", but "I think" those scripts need to be registered via
    chkconfig -add name_here. Or enable in MCC Services.

    That assumes you have created the header correctly.

    head -20 /etc/init.d/network as an example:

    Because of that, you would need to add the start/stop logic.


  8. Re: Equivalent of rc.local but for shutdown?

    Bit Twister wrote:

    > On Sun, 05 Oct 2008 02:46:03 -0400, David W. Hodgins wrote:
    >>
    >> Create a script in /etc/init.d/, that kills the process, with
    >> a filename such as akilltim. Add symlinks to it as
    >> /etc/rc.d/rc0.d/K00akilltim, and also as
    >> /etc/rc.d/rc6.d/K00akilltim.
    >>
    >> The rc0 entry will be executed on halt, and the rc6 entry on
    >> reboot. I haven't tested this, but think it will work.

    >
    > "Not sure", but "I think" those scripts need to be registered via
    > chkconfig -add name_here. Or enable in MCC Services.
    >
    > That assumes you have created the header correctly.
    >
    > head -20 /etc/init.d/network as an example:
    >
    > Because of that, you would need to add the start/stop logic.
    >

    For timidity, there is the timidity-init script I mentioned. BT may recall
    the work he and I did to get Eric Myers' script for Boinc to work
    correctly.

    I have two that I add, both provided: one for spamasssassin and the one for
    boinc. I believe that it is necessary to register them with
    chkconfig --add as BT says. At the top of the script after a hash are all
    the runlevel settings that chkconfig applies; for example the timidity
    script has

    # chkconfig: 2345 20 65

    I suppose that it should be possible to copy one of those scripts and just
    change the program name, but they all seem to differ.

    Doug.
    --
    Dogmatism is only puppyism come to full growth.


  9. Re: Equivalent of rc.local but for shutdown?

    On Mon, 06 Oct 2008 15:10:23 +1100, Doug Laidlaw wrote:
    >
    > I suppose that it should be possible to copy one of those scripts and just
    > change the program name, but they all seem to differ.


    /etc/init.d/atd would be pretty easy to clone. just copy it to new name,
    edit it to change description and /atd lines to application location/name,
    hack around in if clause in start.

  10. Re: Equivalent of rc.local but for shutdown?

    On 2008-10-06, Doug Laidlaw wrote:
    > Bit Twister wrote:
    >
    >> On Sun, 05 Oct 2008 02:46:03 -0400, David W. Hodgins wrote:
    >>>
    >>> Create a script in /etc/init.d/, that kills the process, with
    >>> a filename such as akilltim. Add symlinks to it as
    >>> /etc/rc.d/rc0.d/K00akilltim, and also as
    >>> /etc/rc.d/rc6.d/K00akilltim.
    >>>
    >>> The rc0 entry will be executed on halt, and the rc6 entry on
    >>> reboot. I haven't tested this, but think it will work.

    >>
    >> "Not sure", but "I think" those scripts need to be registered via
    >> chkconfig -add name_here. Or enable in MCC Services.
    >>
    >> That assumes you have created the header correctly.
    >>
    >> head -20 /etc/init.d/network as an example:
    >>
    >> Because of that, you would need to add the start/stop logic.
    >>

    > For timidity, there is the timidity-init script I mentioned. BT may recall
    > the work he and I did to get Eric Myers' script for Boinc to work
    > correctly.
    >
    > I have two that I add, both provided: one for spamasssassin and the one for
    > boinc. I believe that it is necessary to register them with
    > chkconfig --add as BT says. At the top of the script after a hash are all
    > the runlevel settings that chkconfig applies; for example the timidity
    > script has
    >
    > # chkconfig: 2345 20 65
    >
    > I suppose that it should be possible to copy one of those scripts and just
    > change the program name, but they all seem to differ.
    >
    > Doug.


    Many thanks to all who responded with such a wide range of
    suggestions. Unless something else appears between now and
    the next maintenance window, I think I will install the
    timidity-init package, leave it off by default, but make an
    entry in the sudoers file to allow selected users to start
    up the service.

    Thanks.

    --
    Robert Riches
    spamtrap42@verizon.net
    (Yes, that is one of my email addresses.)

  11. Re: Equivalent of rc.local but for shutdown?

    On Sun, 05 Oct 2008 12:49:07 -0400, Bit Twister wrote:

    > "Not sure", but "I think" those scripts need to be registered via
    > chkconfig -add name_here. Or enable in MCC Services.
    > That assumes you have created the header correctly.


    If you don't have the headers, the compat mode will be activated. Checking
    /etc/rc.d/rc, the kill scripts will only be executed if the
    /var/lock/subsys/$subsys file exists, so the script must be executed at
    startup, to create the file, in order for it to be run at shutdown.

    The simplest way is to copy a script such as atd, keep the chkconfig headers,
    and use chkconfig to create the start/kill symlinks. Make sure the creation
    and removal of the /var/lock/subsys file is kept.

    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