#!/bin/ksh # $Id: networkstats.init,v 1.3 2008/11/21 19:32:00 anderson Exp $ # $Source: /usr/msrc/usr/local/libexec/networkstats/RCS/networkstats.init,v $ # Startup for cron-less networkstats # # chkconfig: 2345 90 90 # description: networkstats provides peg info about a host's network interfaces # $Install(*): ssh %s -l root /usr/local/bin/install -o root - /etc/init.d/networkstats <%f \\&\\& /sbin/chkconfig --add networkstats # $Svc(*): ssh %s /usr/local/bin/install -o root - /usr/local/svc/networkstats <%f PROGNAME=`basename $0` PATH="/usr/local/sbin:/usr/local/bin:/usr/local/etc:/usr/local/libexec:$PATH" # General configuraqtion INTS= case _"`id`" in "uid=0(*)"*) RUN_AS="su - monitor -c /bin/ksh" ;; *) RUN_AS=/bin/ksh ;; esac # OS specific overrides case _"`uname -s`" in _SunOS) FMRI=svc:/site/networkstats INTS=`svcprop -p networkstats/interfaces $FMRI` RUN_AS=/bin/ksh ;; *) ;; esac # Now fire them up, stop them, or check them case _"$1" in _start) ( echo nohup /usr/local/libexec/networkstats -p 114 $INTS \& ) | $RUN_AS 2>/dev/null 2>&1 ;; _stop) pkill -U monitor networkstats ;; _version) echo "$PROGNAME: "'$Id: networkstats.init,v 1.3 2008/11/21 19:32:00 anderson Exp $' ;; *) echo "usage: $0 [start|stop]" 1>&2 ;; esac