]> git.pld-linux.org Git - packages/sysstat.git/blob - sysstat.init
up to 11.0.8
[packages/sysstat.git] / sysstat.init
1 #!/bin/sh
2 #
3 # sysstat       Sysstat system monitoring utility
4 #
5 # chkconfig:    2345 35 65
6 #
7 # description:  Sysstat system monitoring tools (sar,iostat,mpstat)
8 #
9 # $Id$
10
11 # Source function library
12 . /etc/rc.d/init.d/functions
13
14 [ -f /etc/sysconfig/sysstat ] && . /etc/sysconfig/sysstat
15
16 start() {
17         # Check if the service is already running?
18         if [ -f /var/lock/subsys/sysstat ]; then
19                 msg_already_running "System Activity Data Collector"
20                 return
21         fi
22
23         msg_starting "System Activity Data Collector"
24         daemon /usr/lib/sa/sadc $SADC_OPTIONS -
25         RETVAL=$?
26         [ "$RETVAL" -eq 0 ] && touch /var/lock/subsys/sysstat
27 }
28
29 stop() {
30         if [ ! -f /var/lock/subsys/sysstat ]; then
31                 msg_not_running "System Activity Data Collector"
32                 return
33         fi
34
35         # Stop daemons.
36         msg_stopping "System Activity Data Collector"
37         ok
38         rm -f /var/lock/subsys/sysstat >/dev/null 2>&1
39 }
40
41 condrestart() {
42         if [ ! -f /var/lock/subsys/sysstat ]; then
43                 msg_not_running "System Activity Data Collector"
44                 RETVAL=$1
45                 return
46         fi
47
48         stop
49         start
50 }
51
52 RETVAL=0
53 # See how we were called.
54 case "$1" in
55   start)
56         start
57         ;;
58   stop)
59         stop
60         ;;
61   restart)
62         stop
63         start
64         ;;
65   try-restart)
66         condrestart 0
67         ;;
68   force-reload)
69         condrestart 7
70         ;;
71   status)
72         status sysstat
73         exit $?
74         ;;
75   *)
76         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
77         exit 3
78         ;;
79 esac
80
81 exit $RETVAL
This page took 0.038787 seconds and 3 git commands to generate.