/etc/init.d/collectl is in collectl 4.0.5-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | #!/bin/sh
# Startup script for collectl on distros that support update-rc.d such
# as debian & ubuintu
#
### BEGIN INIT INFO
# Provides: collectl
# Required-Start: $local_fs $network $remote_fs $syslog $time
# Required-Stop: $local_fs $network $remote_fs $syslog $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Collectl monitors system performance.
# Description: Collectl is a light-weight performance monitoring
# tool capable of reporting interactively as well
# as logging to disk. It reports statistics on
# cpu, disk, infiniband, lustre, memory, network,
# nfs, process, quadrics, slabs and more in easy
# to read format.
### END INIT INFO
# description: Run data collection for a number of subsystems
# see /etc/collectl.conf for startup options
#
# EXAMPLES:
# run at 1 second interval and only collect cpu/disk data
# /etc/init.d/collectl start "-i1 -scd"
# run a second instance with instance name of 'int5', with interval of 5 seconds
# /etc/init.d/collectl start int5 "-i5"
PERL=/usr/bin/perl
COLLECTL=/usr/bin/collectl
. /lib/lsb/init-functions
if [ ! -f $PERL ]; then
echo -n "Cannot find $PERL"
exit 0
fi
if [ ! -f $COLLECTL ]; then
echo -n "Cannot find $COLLECTL"
exit 0
fi
PNAME=collectl
if [ "$2" != "" ]; then
EXT=$2
if [ "$1" = "start" ] || [ "$1" = "restart" ] || [ "$1" = "force-reload" ]; then
if [ "$3" = "" ]; then
SWITCHES=$2
EXT=""
else
SWITCHES=$3
fi
fi
# Just to make sure nothing is different when running 'collectl', we
# won't use --check even though it's probably ok to use all the time.
if [ "$EXT" != "" ]; then
PNAME="collectl-$EXT"
PSWITCH="--pname $EXT"
CHECK="--check $PNAME "
fi
fi
PIDFILE="/var/run/$PNAME.pid"
case "$1" in
start)
echo -n "Starting collectl: $PNAME"
start-stop-daemon --quiet --stop --exec $PERL --pidfile $PIDFILE --test >/dev/null
if [ $? -eq 1 ]; then
start-stop-daemon --quiet --start --exec $COLLECTL -- -D $SWITCHES $PSWITCH
echo "."
else
echo " [already running]"
fi
;;
stop)
echo -n "Stopping collectl: $PNAME"
start-stop-daemon --quiet --stop --retry 2 --exec $PERL --pidfile $PIDFILE
if [ $? -eq 0 ]; then
echo "."
else
echo " [not running]"
fi
;;
flush)
start-stop-daemon --quiet --stop --exec $PERL --pidfile $PIDFILE --test >/dev/null
if [ $? -eq 0 ]; then
echo "Flushing buffers for $PNAME"
kill -s USR1 `cat $PIDFILE`
else
echo "$PNAME is not running"
fi
;;
status)
start-stop-daemon --quiet --stop --exec $PERL --pidfile $PIDFILE --test >/dev/null
if [ $? -eq 0 ]; then
echo "$PNAME is running..."
else
echo "$PNAME is not running"
exit 1
fi
;;
restart|force-reload)
$0 stop $EXT
sleep 1
$0 start "$2" "$3"
;;
*)
echo "Usage: $0 {start|stop|flush|restart|force-reload|status}"
exit 1
esac
exit 0
|