Executing commands on startup and shutdown

From: Adam Bowns (adam-bowns_at_ntlworld.com)
Date: 09/02/03

  • Next message: Sean Estabrooks: "Re: KDE autostart programs --- how and where"
    To: redhat-list@redhat.com
    Date: 02 Sep 2003 00:09:55 +0100
    
    

    Hello everyone,

    I have been trying to execute a command on startup, then a different
    command on shutdown. So far I have had success with executing the
    command on startup, but for some reason, via the exact same method I
    cannot execute the command on shutdown. Here's what im doing: -

    I have the a file names dns-client in my /etc/rc.d/init.d/ directory
    containing the following.

    ---------------------
    #!/bin/sh
                                                                                    
    . /etc/rc.d/init.d/functions
                                                                                    
    case "$1" in
      start)
            echo -n "Starting dns-client: "
            /usr/bin/dns-client-up
            echo
            ;;
      stop)
            echo -n "Shutting down ddclient: "
            /usr/bin/dns-client-down
            echo
            ;;
      *)
            echo "Usage: dns-client {start|stop}"
            exit 1
    esac
                                                                                    
                                                                                    
    exit 0
    ---------------------

    then i have symlinks to this file in my rcX.d dirs, with S's where i
    want the start part of the case statement to execute, and K's where i
    want the stop part of the case statement to execute, here is an example
    of my rc5.d symlink

    S96dns-client -> ../init.d/dns-client

    The starting of the client is working fine so there is no need to bother
    with that, but this is what i have in my rc6.d directory

    K02dns-client -> ../init.d/dns-client

    and my rc0.d directory

    K02dns-client -> ../init.d/dns-client

    As far as I can tell this should execute the stop part of the case
    statement when the system enters runlevel 6 or 0... but its not, its as
    if nothing happens, no errors, nothing... the system just shuts down as
    normal. btw, all file permissions are the the same as the other files in
    those dirs.

    Have I got it all wrong or should this setup work ?

    Thanks in advance,
    Adam Bowns
    http://www.bowns.co.uk

    -- 
    redhat-list mailing list
    unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
    https://www.redhat.com/mailman/listinfo/redhat-list
    

  • Next message: Sean Estabrooks: "Re: KDE autostart programs --- how and where"

    Relevant Pages

    • [Full-Disclosure] Advanced usage of system() function.
      ... and call its arguments as a command for shell. ... as we can see we still didnt get what we want (typing exit ... Connection closed by foreign host. ... think what we want to execute. ...
      (Full-Disclosure)
    • Advanced usage of system() function.
      ... and call its arguments as a command for shell. ... as we can see we still didnt get what we want (typing exit we are ... Connection closed by foreign host. ... think what we want to execute. ...
      (Bugtraq)
    • Re: Wait for background processes to complete
      ... To be able to execute commands in the background and wait for their ... The documentation I am referring to is http://perldoc.perl.org/. ... You can run a command in the background with: ... There is a general problem with perl documentation: ...
      (comp.lang.perl.misc)
    • Execute Process Task not failing, but not executing the batch comm
      ... I can execute the following command from the windows "Run" prompt and it ... Might I have something set weird in SQL Server? ... server being by default configured to run as localsystem account, ...
      (microsoft.public.sqlserver.dts)
    • Re: IIS 6.0 on Windows Server 2003
      ... If PHP insists on using CMD.EXE to execute the shellcommand on the ... server, then no, you have no choice -- you must give read permissions to the ... this would be a security vulnerability caused by PHP. ...
      (microsoft.public.inetserver.misc)