RE: Executing commands on startup and shutdown

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

  • Next message: Benjamin J. Weiss: "[SOLVED] Re: Bind 9 named on RH 9 only listens to local machine?"
    To: redhat-list@redhat.com
    Date: 02 Sep 2003 13:54:04 +0100
    
    

    Thanks Hugh,

    I tried that and Its working as expected now.

    Regards,
    Adam Bowns

    On Tue, 2003-09-02 at 04:15, Hugh E Cruickshank wrote:
    > Hi Adam:
    >
    > That one got me too. Try this suggestion that Brian Ashe gave me
    > last year:
    >
    > >Try this... (It's just a WAG)
    > >
    > >Add a line...
    > >touch /var/lock/subsys/fapsrv
    > >to the "start" portion of your script.
    > >and of course it's counterpart...
    > >rm -f /var/lock/subsys/fapsrv
    > >to the "stop" portion.
    > >
    > >IIRC, RHL needs to see that the thing was started in order to execute the
    > >stop. It does this by checking for the existence of a file in
    > >/var/lock/subsys/ that matches the name of the script being called (after
    > >the K?? part).
    >
    > HTH
    >
    > Regards, Hugh
    >
    > --
    > Hugh E Cruickshank, Forward Software, www.forward-software.com
    >
    > From: Adam Bowns Sent: Monday, September 01, 2003 16:10
    > > To: redhat-list@redhat.com
    > > Subject: Executing commands on startup and shutdown
    > >
    > >
    > > 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
    > >
    > > ---
    > > Incoming mail is certified Virus Free.
    > > Checked by AVG anti-virus system (http://www.grisoft.com).
    > > Version: 6.0.515 / Virus Database: 313 - Release Date: 03/09/01
    > >
    > ---
    > Outgoing mail is certified Virus Free.
    > Checked by AVG anti-virus system (http://www.grisoft.com).
    > Version: 6.0.515 / Virus Database: 313 - Release Date: 03/09/01
    >

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

  • Next message: Benjamin J. Weiss: "[SOLVED] Re: Bind 9 named on RH 9 only listens to local machine?"

    Relevant Pages

    • Re: Component Registration Failure
      ... Execute the command regsvr32.exe atl.dll ... The message was checked by ESET Smart Security. ...
      (microsoft.public.windows.mediacenter)
    • Re: Component Registration Failure
      ... You could try running the following command from a command prompt: ... Execute the command regsvr32.exe atl.dll ... The message was checked by ESET Smart Security. ...
      (microsoft.public.windows.mediacenter)
    • Re: ISQL - Executing Multiple sql files
      ... onces i login how do we execute the files.. ... Regards ... > You'll need to double-up the '%' if the command is included in a BAT file. ... >> Govardhan MV ...
      (microsoft.public.sqlserver.server)
    • Re: Way to mass remove the deleted (X tasks) in the PWA side?
      ... You can setup a scheduled job in SQL server to execute the following T-SQL ... Regards, ...
      (microsoft.public.project.pro_and_server)
    • [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)