#!/bin/sh # Description: Start or stop the usermin server start=/etc/usermin/start stop=/etc/usermin/stop lockfile=/var/lock/subsys/usermin confFile=/etc/usermin/miniserv.conf pidFile=/var/usermin/miniserv.pid case "$1" in 'start') $start >/dev/null 2>&1 /dev/null 2>&1 echo "usermin Started" fi ;; 'stop') $stop RETVAL=$? if [ "$RETVAL" = "0" ]; then rm -f $lockfile fi pidfile=`grep "^pidfile=" $confFile | sed -e 's/pidfile=//g'` if [ "$pidfile" = "" ]; then pidfile=$pidFile fi echo "usermin Stopped" rm -f $pidfile ;; 'status') pidfile=`grep "^pidfile=" $confFile | sed -e 's/pidfile=//g'` if [ "$pidfile" = "" ]; then pidfile=$pidFile fi if [ -s $pidfile ]; then pid=`cat $pidfile` kill -0 $pid >/dev/null 2>&1 if [ "$?" = "0" ]; then echo "usermin (pid $pid) is running" RETVAL=0 else echo "usermin is stopped" RETVAL=1 fi else echo "usermin is stopped" RETVAL=1 fi ;; 'restart') $stop ; $start RETVAL=$? ;; help|--help|-h) echo "" echo "To use the usermin program you must first start the" echo "usermin mini-webserver by running 'usermin start' (as root)" echo "" echo "Then, point your web browser to:" echo "http://localhost:${port}" echo "" ;; *) echo "Usage: $0 { start | stop | restart }" RETVAL=1 ;; esac exit $RETVAL