custom init.d script will start but won't stop
Hey all, I've written a custom init.d script that will basically run a script /root/home/scripts/startup on startup and then when the server is shutting down run /root/home/scripts/shutdown.
I've run chkconfig --add testscript and it does have correct sym links for S and K in rc3.d,rc5.d, rc0.d, rc6.0.
Can anybody suggest anything?
Thanks,
Q
#!/bin/bash
#
# chkconfig: 35 75 10
# description: my test server function
#
#Source function library.
. /etc/init.d/functions
start() {
initlog -c "echo -n TESTSCRIPT starting: "
/root/scripts/startscript
### touch the lock file ###
touch /var/lock/subsys/startscript
touch /var/lock/subsys/stopscript
success $"My test script starting"
echo
}
stop() {
initlog -c "echo -n RUNNING STOPSCRIPT: "
/root/scripts/stopscript
### Remove the lock file ###
rm -f /var/lock/subsys/startscript
rm -f /var/lock/subsys/stopscript
success $"My test script stopping"
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status servicename
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit 0
|