LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Closed Thread
 
Search this Thread
Old 05-03-2007, 10:22 AM   #1
Qwerty9119
LQ Newbie
 
Registered: Aug 2006
Posts: 13

Rep: Reputation: 0
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
 
Old 05-03-2007, 12:06 PM   #2
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,007
Blog Entries: 5

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
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.
 
Old 05-03-2007, 12:23 PM   #3
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Lubuntu
Posts: 19,176
Blog Entries: 4

Rep: Reputation: 430Reputation: 430Reputation: 430Reputation: 430Reputation: 430
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.
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to register auto start/stop service script with chkconfig travellers Linux - Software 8 06-15-2009 11:02 AM
custom init.d script will start but won't stop Qwerty9119 Red Hat 2 05-03-2007 12:51 PM
pure-ftpd init script fails to start server in standalone mode Cronjob Debian 1 05-23-2006 12:11 AM
using cron to start and stop a bash script monty Linux - Software 2 03-20-2006 02:30 PM
need a perl script to stop & start program cccc Programming 43 07-23-2005 07:27 PM


All times are GMT -5. The time now is 05:30 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration