View this PageEdit this Page (locked)Uploads to this PageVersions of this PageHomeRecent ChangesSearchHelp Guide

Redhat init script

Save this as /etc/init.d/swiki. Set SWIKI_CMD and SWIKI_IMG appropriately. Then you can run 'chkconfig –add swiki' to install it and '/etc/init.d/swiki start' to start it.

 #!/bin/sh
 #
 # swiki Control the Squeak swiki
 #
 # chkconfig: 2345 99 10
 # description: Control the Squeak swiki
 #
 
 SWIKI_CMD=${SWIKI_CMD:-"/usr/local/ComSwiki/squeak"}
 SWIKI_IMG=${SWIKI_IMG:-"/usr/local/ComSwiki/squeak.image"}
 
 if [ -f /etc/init.d/functions ] ; then
     . /etc/init.d/functions
 elif [ -f /etc/rc.d/init.d/functions ] ; then
     . /etc/rc.d/init.d/functions
 else
     exit 0
 fi
 
 . /etc/sysconfig/network
 
 [ ${NETWORKING} = "no" ] & exit 0
 
 RETVAL=0
 
 start() {
     echo -n $"Starting Squeak swiki: "
     ${SWIKI_CMD} -headless ${SWIKI_IMG} &
     RETVAL=$?
     [ $RETVAL -eq 0 ] & success $"$base startup" || failure $"$base startup"
     [ $RETVAL -eq 0 ] & touch /var/lock/subsys/swiki
     echo
     return $RETVAL
 }
 
 stop() {
     echo -n $"Stopping Squeak swiki"
     killproc squeak
     RETVAL=$?
     [ $RETVAL -eq 0 ] & rm -f /var/lock/subsys/swiki
     echo
     return $RETVAL
 }
 
 restart() {
     stop
     start
 }
 
 case $1 in
 start)
     start
     ;;
 stop)
     stop
     ;;
 restart)
     restart
     ;;
 )
     echo "Usage: $0 {start|stop|restart}"
     exit 1
 esac
 
 exit $?


Update

Hello,

I have made three changes in this script in my installation (RedHat 8.0):

a) Changed from:
 SWIKI_CMD=${SWIKI_CMD:-"/usr/local/ComSwiki/squeak"}
 SWIKI_IMG=${SWIKI_IMG:-"/usr/local/ComSwiki/squeak.image"}
to:
 SWIKI_CMD=/usr/local/ComSwiki/squeak
 SWIKI_IMG=/usr/local/ComSwiki/squeak.image

b) Changed from:
 [ ${NETWORKING} = "no" ] & exit 0
to:
 [ ${NETWORKING} = "no" ] && exit 0

c) Changed from:
 restart)
     restart
     ;;
 )
     echo "Usage: $0 {start|stop|restart}"
to:
 restart)
     restart
     ;;
 *)
     echo "Usage: $0 {start|stop|restart}"

Also, I had to remove the first white space of every line, after a copy-and-paste from this page.

I choose not to change the original script on this page so others can check if my changes are really necessary.

Best regards,

mangan@acm.org

Link to this Page

  • Enhancements last edited on 7 March 2007 at 3:31 pm by 135.244.1.143