Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
#!/bin/bash
2
#
3
# psacct	Script to control kernel process accounting
4
#
5
# Author:       Mike A. Harris <mharris@redhat.com>
6
#
7
# chkconfig: - 90 10
8
# description:  Starts and stops process accounting
9
# short-description:  Starts and stops process accounting
10
 
11
### BEGIN INIT INFO
12
# Required-Start:
13
# Required-Stop:
14
# Provides: psacct
15
# Default-Start:
16
# Default-Stop: 0 1 2 3 4 5 6
17
# Description: Starts and stops process accounting
18
# Short-Description: Starts and stops process accounting
19
### END INIT INFO
20
 
21
# Source function library.
22
. /etc/init.d/functions
23
 
24
# The location of the accounting file
25
ACCTFILE=/var/account/pacct
26
LOCKFILE=/var/lock/subsys/psacct
27
 
28
start() {
29
	[ ! -r $ACCTFILE ] && touch $ACCTFILE && chmod 600 $ACCTFILE
30
	if [ -r $ACCTFILE ]; then
31
	    action $"Starting process accounting: " /sbin/accton $ACCTFILE
32
	    RETVAL=$?
33
    	    if [ $RETVAL -eq 0 ]; then
34
		touch $LOCKFILE
35
	    else
36
		exit 7
37
	    fi
38
	else
39
	    exit 4
40
	fi
41
}
42
 
43
stop() {
44
 
45
	action $"Shutting down process accounting: " /sbin/accton
46
	RETVAL=$?
47
	if [ $RETVAL -eq 0 ]; then
48
	    rm -f $LOCKFILE
49
	else
50
	    exit 1
51
	fi
52
}
53
 
54
# See how we were called.
55
case "$1" in
56
  start)
57
	start
58
	;;
59
  stop)
60
	stop
61
	;;
62
  status)
63
	if [ -e $LOCKFILE ]; then
64
		echo $"Process accounting is enabled."
65
	else
66
		echo $"Process accounting is disabled."
67
		exit 3
68
	fi
69
	;;
70
  restart|reload|force-reload)
71
	stop
72
	start
73
	;;
74
  *)
75
	# do not advertise unreasonable commands that there is no reason
76
	# to use with this device
77
	echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}"
78
	exit 2
79
esac
80
 
81
exit 0
82