#!/bin/sh # Startup script for collectl # # chkconfig: 345 99 1 # description: Run data collection for a number of subsystems # see /etc/collectl.conf for startup options # processname: collectl # pidfile: /var/run/collectl.pid ### BEGIN INIT INFO # Provides: collectl # Required-Start: $syslog # Required-Stop: $syslog # Default-Start: 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Data Collection Gathering # Description: Run data collection for a number of subsystems # see /etc/collectl.conf for startup options ### END INIT INFO RETVAL=0 COLLECTL=/usr/sbin/collectl # Source function library. . /etc/rc.d/init.d/functions if [ ! -f $COLLECTL ]; then echo "Cannot find $COLLECTL" exit 1 fi case "$1" in start) gprintf "Starting collectl:" COMMAND="$COLLECTL -D" daemon $COLLECTL -D RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/collectl ;; stop) if [ -f /var/run/collectl.pid ]; then gprintf "Shutting down collectl: " killproc collectl RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/collectl else gprintf "collectl does not appear to be running so will not be shut down" fi ;; flush) if [ -f /var/run/collectl.pid ]; then pid=`cat /var/run/collectl.pid` gprintf "Flushing buffers for collectl" kill -s USR1 $pid else gprintf "Can't find pid file /var/run/collectl.pid" fi ;; restart|reload) $0 stop $0 start RETVAL=$? ;; status) status collectl RETVAL=$? ;; *) gprintf "Usage: $0 {start|stop|flush|restart|status}" exit 1 esac exit $RETVAL