LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   custom init.d script will start but won't stop (http://www.linuxquestions.org/questions/linux-general-1/custom-init-d-script-will-start-but-wont-stop-550985/)

Qwerty9119 05-03-2007 10:22 AM

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? Sorry I've also posted this in the Red Hat forum. I'm running Red Hat Enterprise 4.0.

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

MensaWater 05-03-2007 12:06 PM

Naught. Naughty. You're only supposed to post in one forum. If you think you chose the wrong one you should ask the moderator to move it. :tisk:

XavierP 05-03-2007 12:23 PM

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.


All times are GMT -5. The time now is 08:18 PM.