2004-09-09 10:47:19 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# psacct Script to control kernel process accounting
|
|
|
|
#
|
|
|
|
# Author: Mike A. Harris <mharris@redhat.com>
|
|
|
|
#
|
|
|
|
# chkconfig: - 90 10
|
|
|
|
# description: Starts and stops process accounting
|
|
|
|
|
|
|
|
# Source function library.
|
|
|
|
. /etc/init.d/functions
|
|
|
|
|
|
|
|
# The location of the accounting file
|
|
|
|
ACCTFILE=/var/account/pacct
|
|
|
|
|
2004-09-09 10:48:16 +00:00
|
|
|
start() {
|
2004-09-09 10:47:24 +00:00
|
|
|
[ ! -r $ACCTFILE ] && touch $ACCTFILE && chmod 600 $ACCTFILE
|
2004-09-09 10:47:19 +00:00
|
|
|
action $"Starting process accounting: " /sbin/accton $ACCTFILE
|
|
|
|
touch /var/lock/subsys/psacct
|
2004-09-09 10:48:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2004-09-09 10:47:19 +00:00
|
|
|
action $"Shutting down process accounting: " /sbin/accton
|
|
|
|
rm -f /var/lock/subsys/psacct
|
2004-09-09 10:48:16 +00:00
|
|
|
}
|
|
|
|
# See how we were called.
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
2004-09-09 10:47:19 +00:00
|
|
|
;;
|
|
|
|
status)
|
|
|
|
if [ -e /var/lock/subsys/psacct ]; then
|
|
|
|
echo $"Process accounting is enabled."
|
|
|
|
else
|
|
|
|
echo $"Process accounting is disabled."
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
restart|reload)
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# do not advertise unreasonable commands that there is no reason
|
|
|
|
# to use with this device
|
|
|
|
echo $"Usage: $0 {start|stop|status|restart|reload}"
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|