On Wed, Mar 27, 2002 at 07:03:56PM -0500, Mike Sassak wrote: > The following 'old-fashioned way' won't get you the convenience of using > 'chkconfig', 'service', etc. but it does work. > > Just add these two lines to the end of /etc/rc.d/rc.local:
Old-fashioned and deprecated, you Slackware fan you! :-) A good thing when init-scripts behave like that is to check output and logs. Secondly, I don't know about RH, but all other dists I've used have a skeleton init-script to be copied and modified for creating new init-scripts. It should take arguments "start", "stop" an "restart" as a minimum. You should exit with correct codes to tell the daemon script if start really was OK or not. That's the way to do it. For using the script at http://www.bluecows.com/scripts/jabberd.start make sure your Jabber server actualy is in "/opt". According to Linux standards anything not distribution related should end up in "/usr/local", I think "/opt" is an invention of Sun? Hehe, standards are nice only if used. ;-) I'm including a small init-script. It does not use the nice color stuff that RH and other RH-based dists use, but it works fine on my Debian and Slackware. /P --- #!/bin/bash # # jabber Will start, stop and restart Jabber daemon at will. # # Written by Peter Gebauer <[EMAIL PROTECTED]>. # Modified for the Jabber mailing list <[EMAIL PROTECTED]>. # # This should be changed to wherever your stuff is: INSTALLED=/usr/local # This should be changed to wherever your Jabber dist is: JABBERDIR=$INSTALLED/src/jabber # This should be changed to where your Jabber daemon PID-file is: PIDFILE=$JABBERDIR/jabber.pid # This should be changed to where your Jabber daemon binary is: JABBERD=$JABBERDIR/jabberd/jabberd DAEMON=jabberd NAME=jabber DESC="Jabber daemon" THIS=/etc/init.d/$NAME if [ ! -x $JABBERBIN ]; then echo "Could not find executable $JABBERBIN!" echo "You need to configure $THIS with correct paths." exit 4 fi case "$1" in start) echo -n "Starting $DESC: " if [ -e "$PIDFILE" ]; then PIDNUM=`cat $PIDFILE` fi if [ -n "$PIDNUM" ] && [ -n "$DAEMON" ]; then ISRUNNING=`ps -A | grep $PIDNUM | grep $DAEMON` fi if [ -n "$ISRUNNING" ]; then echo "already running! (PID: $PIDNUM)" exit 101 fi nohup $JABBERD >/dev/null 2>&1 & if [ "$?" -ne 0 ]; then echo "failed to start!" exit 102 fi echo "OK." ;; stop) echo -n "Stopping $DESC: " if [ -e "$PIDFILE" ]; then PIDNUM=`cat $PIDFILE` fi if [ -n "$PIDNUM" ]; then kill -TERM $PIDNUM > /dev/null 2>&1 KILLRESULT=$? fi if [ -z "$PIDNUM" ] || [ "$KILLRESULT" -ne 0 ]; then echo -n "Killing all processes named $DAEMON: " killall -TERM $DAEMON > /dev/null 2>&1 if [ "$?" -ne 0 ]; then rm -f $PIDFILE echo "failed! (perhaps it was not running?)" exit 201 fi fi rm -f $PIDFILE echo "OK." ;; restart) echo "Restart requested: " $THIS stop sleep 1 $THIS start ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart}" >&2 exit 1 ;; esac exit 0 _______________________________________________ jdev mailing list [EMAIL PROTECTED] http://mailman.jabber.org/listinfo/jdev
