View this PageEdit this PageUploads to this PageVersions of this PageHomeRecent ChangesSearchHelp Guide

RedHat Init Script Version 2.0

  1. Save this as /etc/init.d/swiki.
  2. Set SWIKI_CMD and SWIKI_IMG appropriately.
  3. Make the init script executable: chmod 755 /etc/init.d/swiki
  4. Run chkconfig –add swiki to create the appropriate symbolic links in the various /etc/rc*.d directories.
    • Check your handiwork: chkconfig –list |grep swiki or find /etc -name *swiki
  5. Run /etc/init.d/swiki start to start Swiki.

The code fragment below has been encapsulated in <html> and <pre> tags, so it should be easy to copy and paste the whole chunk into your favorite editor and save it.

#!/bin/sh
#
# swiki Control the Squeak Swiki
#
# chkconfig: 345 99 10
# description: Control the Squeak Swiki
#

SWIKI_CMD="/usr/local/ComSwiki/squeak"
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 || failure
    [ $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
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
        start
        ;;
    *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
esac

exit $RETVAL


The changes suggested by mangan@acm.org on the original page make sense. The original page has been locked, so the shell script has been copied here and updated apropriately.

Links to this Page