#!/bin/bash
#
# chkconfig: 345 95 5
# description: Enable autoload of perfctr on systems using udev.
# source function library
. /etc/init.d/functions
RETVAL=0
start() {
if [ ! -f /dev/perfctr ]; then
echo -n $"Enabling perfctr autoloading: "
mknod --mode=644 /dev/perfctr c 10 182
RETVAL=$?
fi
return $RETVAL
}
stop() {
if grep perfctr /proc/modules >/dev/null 2>&1 ; then
echo -n $"Unloading perfctr module: "
rmmod perfctr
RETVAL=$?
echo
fi
return $RETVAL
}
mystatus() {
if grep perfctr /proc/misc >/dev/null 2>&1 ; then
echo $"perfctr is present in this kernel"
RETVAL=0
else
echo $"perfctr is not present in this kernel"
RETVAL=3
fi
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
condrestart)
if grep perfctr /proc/misc ; then
stop
start
fi
;;
status)
mystatus
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
exit $RETVAL