#!/bin/bash # # Copyright (c) 2004 by MicroDowell SpA # All rights reserved. # # ident "@(#)rcupseye 1.1 2004/07/28" # ### BEGIN INIT INFO # Provides: rcupseye # Required-Start: $network # Required-Stop: $network # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Description: Start the rcupseye daemon ### END INIT INFO . /etc/rc.status . /etc/rc.config # Determine the base and follow a runlevel link name. base=${0##*/} link=${base#*[SK][0-9][0-9]} # Shell functions sourced from /etc/rc.status: # rc_check check and set local and overall rc status # rc_status check and set local and overall rc status # rc_status -v ditto but be verbose in local rc status # rc_status -v -r ditto and clear the local rc status # rc_failed set local and overall rc status to failed # rc_reset clear local rc status (overall remains) # rc_exit exit appropriate to overall rc status # __START__: do not remove or move this comment!!!!! (needed by sed) # path of the directory containig the 'upseye.pl' file SCRIPTPATH="/usr/sbin/microdowell" # perl script file to be run SCRIPTFILE="upseye.pl" # options for running perl OPTIONS="" # options for running 'upseye.pl' script PERLOPTIONS="-I /usr/sbin/microdowell " # path of the 'cat' command CATPATH="/bin/cat" # path of the 'perl' command PERLPATH="/usr/bin/perl" # PID of the perl process to be killed PIDFILE="/usr/sbin/microdowell/thepid" # __STOP__: do not remove or move this comment!!!!! (needed by sed) # get the name of the system OSname=`uname` # First reset status of this service rc_reset case $1 in 'start') if [ "$SCRIPTPATH" == "__SCRIPTPATH__" ] ; then SCRIPTPATH="." fi if [ "$OPTIONS" == "__OPTIONS__" ] ; then OPTIONS="" fi if [ "$PERLOPTIONS" == "__PERLOPTIONS__" ] ; then PERLOPTIONS="" fi if [ "$PERLPATH" == "__PERLPATH__" ] ; then PERLPATH="/usr/bin/perl" fi if [ "$OSname" == "SunOS" ] ; then printf "Starting upseye UPS daemon: " else echo -n "Starting upseye UPS daemon: " fi $PERLPATH $PERLOPTIONS $SCRIPTPATH/$SCRIPTFILE $OPTIONS ;; 'stop') if [ "$OSname" == "SunOS" ] ; then printf "Stopping upseye UPS daemon: " else echo -n "Stopping upseye UPS daemon: " fi if [ -f "$PIDFILE" ]; then kill -9 `$CATPATH $PIDFILE` #rm -f $PIDFILE if [ "$OSname" == "SunOS" ] ; then printf "Stopped\n" else echo "Stopped" fi fi ;; *) echo "Usage: $0 { start | stop }" exit 1 ;; esac