Logoj0ke.net Open Build Service > Projects > server:monitoring > collectd > collectd.suse.init
Sign Up | Log In

File collectd.suse.init of Package collectd (Revision 11)

Currently displaying revision 11, show latest

x
 
1
#! /bin/sh
2
# Author: Pascal Bleser <guru@unixtech.be>
3
# Please send feedback to guru@unixtech.be
4
#
5
# /etc/init.d/collectd
6
#   and its symbolic link
7
# /usr/sbin/rccollectd
8
#
9
### BEGIN INIT INFO
10
# Provides:          collectd
11
# Required-Start:    $local_fs $remote_fs $network
12
# Required-Stop:     $local_fs $remote_fs $network
13
# Default-Start:     3 5
14
# Default-Stop:      0 1 2 6
15
# Short-Description: Collectd daemon collecting system statistics
16
# Description:       Start Collectd to collect system statistics
17
### END INIT INFO
18
19
# Check for missing binaries (stale symlinks should not happen)
20
# Note: Special treatment of stop for LSB conformance
21
COLLECTD_BIN=/usr/sbin/collectd
22
test -x $COLLECTD_BIN || { echo "$COLLECTD_BIN not installed"; 
23
    if [ "$1" = "stop" ]; then exit 0;
24
    else exit 5; fi; }
25
26
# Check for existence of needed config file and read it
27
COLLECTD_CONFIG=/etc/collectd.conf
28
test -r $COLLECTD_CONFIG || { echo "$COLLECTD_CONFIG not existing";
29
    if [ "$1" = "stop" ]; then exit 0;
30
    else exit 6; fi; }
31
32
SERVICENAME=collectd
33
34
. /etc/rc.status
35
# Reset status of this service
36
rc_reset
37
38
case "$1" in
39
    start)
40
    echo -n "Starting $SERVICENAME "
41
    /sbin/startproc "$COLLECTD_BIN"
42
    rc_status -v
43
    ;;
44
    stop)
45
    echo -n "Shutting down $SERVICENAME "
46
    /sbin/killproc -TERM "$COLLECTD_BIN"
47
    rc_status -v
48
    ;;
49
    try-restart|condrestart)
50
    ## Do a restart only if the service was active before.
51
    ## Note: try-restart is now part of LSB (as of 1.9).
52
    ## RH has a similar command named condrestart.
53
    if test "$1" = "condrestart"; then
54
        echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
55
    fi
56
    $0 status
57
    if test $? = 0; then
58
        $0 restart
59
    else
60
        rc_reset    # Not running is not a failure.
61
    fi
62
    rc_status
63
    ;;
64
    restart)
65
    $0 stop
66
    $0 start
67
    rc_status
68
    ;;
69
    force-reload)
70
    echo -n "Reload service $SERVICENAME "
71
    $0 try-restart
72
    rc_status
73
    ;;
74
    reload)
75
    rc_failed 3
76
    rc_status -v
77
    ;;
78
    status)
79
    echo -n "Checking for service $SERVICENAME "
80
    /sbin/checkproc $COLLECTD_BIN
81
    rc_status -v
82
    ;;
83
    probe)
84
    ## Optional: Probe for the necessity of a reload, print out the
85
    ## argument to this init script which is required for a reload.
86
    ## Note: probe is not (yet) part of LSB (as of 1.9)
87
88
    test "$COLLECTD_CONFIG" -nt "/var/run/collectd.pid" && echo reload
89
    ;;
90
    *)
91
    echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
92
    exit 1
93
    ;;
94
esac
95
rc_exit
96