Blame | Last modification | View Log | RSS feed
#!/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# short-description: Starts and stops process accounting### BEGIN INIT INFO# Required-Start:# Required-Stop:# Provides: psacct# Default-Start:# Default-Stop: 0 1 2 3 4 5 6# Description: Starts and stops process accounting# Short-Description: Starts and stops process accounting### END INIT INFO# Source function library.. /etc/init.d/functions# The location of the accounting fileACCTFILE=/var/account/pacctLOCKFILE=/var/lock/subsys/psacctstart() {[ ! -r $ACCTFILE ] && touch $ACCTFILE && chmod 600 $ACCTFILEif [ -r $ACCTFILE ]; thenaction $"Starting process accounting: " /sbin/accton $ACCTFILERETVAL=$?if [ $RETVAL -eq 0 ]; thentouch $LOCKFILEelseexit 7fielseexit 4fi}stop() {action $"Shutting down process accounting: " /sbin/acctonRETVAL=$?if [ $RETVAL -eq 0 ]; thenrm -f $LOCKFILEelseexit 1fi}# See how we were called.case "$1" instart)start;;stop)stop;;status)if [ -e $LOCKFILE ]; thenecho $"Process accounting is enabled."elseecho $"Process accounting is disabled."exit 3fi;;restart|reload|force-reload)stopstart;;*)# do not advertise unreasonable commands that there is no reason# to use with this deviceecho $"Usage: $0 {start|stop|status|restart|reload|force-reload}"exit 2esacexit 0