#!/bin/bash # # Copyright (c) 2004 by MicroDowell SpA # All rights reserved. # # ident "@(#)rcupseyecl 1.1 2004/07/28" # ### BEGIN INIT INFO # Provides: rcupseyecl # Required-Start: $network # Required-Stop: $network # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Description: Start the rcupseyecl 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 'upseyecl.pl' file SCRIPTPATH="__SCRIPTPATH__" # perl script file to be run SCRIPTFILE="upseyecl.pl" #options for running perl OPTIONS="__OPTIONS__" #options for running 'upseyecl.pl' script PERLOPTIONS="__PERLOPTIONS__" # path of the 'cat' command CATPATH="__CATPATH__" # path of the 'perl' command PERLPATH="__PERLPATH__" # PID of the perl process to be killed PIDFILE="__PIDFILE__" # __STOP__: do not remove or move this comment!!!!! (needed by sed) 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 $SCRIPTFILE UPS daemon: " else echo -n "Starting $SCRIPTFILE UPS daemon: " fi $PERLPATH $PERLOPTIONS $SCRIPTPATH/$SCRIPTFILE $OPTIONS ;; 'stop') if [ "$OSname" == "SunOS" ] ; then printf "Stopping $SCRIPTFILE UPS daemon: " else echo -n "Stopping $SCRIPTFILE 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 ;; 'restart') $0 stop $0 start ;; *) echo "Usage: rcupseye { start | stop | restart }" exit 1 ;; esac