[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Executing commands on startup and shutdown
- From: Adam Bowns <adam-bowns ntlworld com>
- To: redhat-list redhat com
- Subject: Executing commands on startup and shutdown
- Date: Mon Sep 1 19:08:02 2003
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
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]