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

Solaris Init Script

This script is rather shamelessly based on the RedHat init script, but it is stripped down, because Solaris does not have all of those funky shell script functions.

You know... in the version of Swiki that we are running here, we have access to the <code> tag that makes it very easy to add blocks of code to our site. The code tags do not seem to work here... Ok... using a combination of the <html> and <pre> tags seems to have accomplished what the <code> tag does. Voila! Shell script follows.

#!/bin/sh
#
# File: /etc/init.d/swiki
#
# Purpose: Initialization script for the Squeak Swiki
#

SWIKI_CMD="/usr/local/ComSwiki/squeak"
SWIKI_IMG="/usr/local/ComSwiki/squeak.image"
 
RETVAL=0
 
start() {
    echo "Starting Squeak Swiki: \c"
    $SWIKI_CMD -headless $SWIKI_IMG &
    RETVAL=$?
    [ $RETVAL -eq 0 ] && echo "ok" || echo "failed"
    return $RETVAL
}
 
stop() {
    echo "Stopping Squeak Swiki: \c"
    SQUEAK_PID=`ps -ef |grep $SQUEAK_CMD |grep -v grep |awk '{print $2}'`
    kill $SQUEAK_PID
    RETVAL=$?
    [ $RETVAL -eq 0 ] && echo "ok" || echo "failed"
    return $RETVAL
}

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

exit $RETVAL


Drop this file into /etc/init.d, make it executable, and create a sybolic link to it from either /etc/rc2.d or /etc/rc3.d depending upon your personal preference:

vi /etc/init.d/swiki
chmod 755 /etc/init.d/swiki
ln -s ../init.d/swiki /etc/rc3.d/S55swiki


Link to this Page

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