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