~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to vivid/etc/init.d/xymon-client

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
#
 
3
# xymon-client    This shell script takes care of starting and stopping
 
4
#                 the xymon client.
 
5
 
 
6
### BEGIN INIT INFO
 
7
# Provides:          xymon-client
 
8
# Required-Start:    $remote_fs $network
 
9
# Should-Start:      $all
 
10
# Required-Stop:     $remote_fs
 
11
# Default-Start:     2 3 4 5
 
12
# Default-Stop:      0 1 6
 
13
# Short-Description: Xymon system monitor client
 
14
# Description:       Client to feed system data to a remote Xymon server.
 
15
### END INIT INFO
 
16
 
 
17
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 
18
DAEMON="/usr/lib/xymon/client/bin/xymonlaunch"
 
19
NAME=xymon-client
 
20
DESC="Xymon Client"
 
21
PIDFILE="/var/run/xymon/clientlaunch.pid"
 
22
XYMONCLIENTHOME="/usr/lib/xymon/client"
 
23
 
 
24
test -x $DAEMON || exit 0
 
25
 
 
26
. /lib/lsb/init-functions
 
27
. /usr/share/xymon/init-common.sh
 
28
 
 
29
# Include xymon-client defaults if available
 
30
if [ -f /etc/default/xymon-client ] ; then
 
31
        . /etc/default/xymon-client
 
32
fi
 
33
[ -z "$MACHINE" ] && MACHINE="$CLIENTHOSTNAME"
 
34
[ -z "$MACHINEDOTS" ] && MACHINEDOTS="`hostname -f`"
 
35
export XYMONSERVERS XYMONCLIENTHOME CLIENTHOSTNAME MACHINE MACHINEDOTS
 
36
 
 
37
case "$1" in
 
38
  start)
 
39
        # do not run the client script on the server
 
40
        [ -x /usr/lib/xymon/server/bin/xymond ] && exit 0
 
41
 
 
42
        create_includefiles
 
43
 
 
44
        if test "$TMPFSSIZE" && test -e /proc/mounts && ! grep -q /var/lib/xymon/tmp /proc/mounts; then
 
45
                echo "Mounting tmpfs on /var/lib/xymon/tmp"
 
46
                rm -f /var/lib/xymon/tmp/*
 
47
                mount -t tmpfs -o"size=$TMPFSSIZE,mode=755,uid=$(id -u xymon)" tmpfs /var/lib/xymon/tmp
 
48
        fi
 
49
 
 
50
        log_daemon_msg "Starting $DESC" "$NAME"
 
51
        start-stop-daemon --exec $DAEMON --chuid xymon --umask 022 --start \
 
52
                -- \
 
53
                --config=/etc/xymon/clientlaunch.cfg \
 
54
                --log=/var/log/xymon/clientlaunch.log \
 
55
                --pidfile=$PIDFILE
 
56
        log_end_msg $?
 
57
        ;;
 
58
  stop)
 
59
        log_daemon_msg "Stopping $DESC" "$NAME"
 
60
        start-stop-daemon --exec $DAEMON --pidfile $PIDFILE --stop --retry 5
 
61
        log_end_msg $?
 
62
        ;;
 
63
  status)
 
64
        if test -s $PIDFILE
 
65
        then
 
66
                kill -0 `cat $PIDFILE`
 
67
                if test $? -eq 0
 
68
                then
 
69
                        echo "Xymon client running with PID `cat $PIDFILE`"
 
70
                        exit 0
 
71
                else
 
72
                        echo "Xymon client not running, removing stale PID file"
 
73
                        rm -f $PIDFILE
 
74
                        exit 1
 
75
                fi
 
76
        else
 
77
                echo "Xymon client does not appear to be running"
 
78
                exit 3
 
79
        fi
 
80
        ;;
 
81
  restart)
 
82
        if [ -x /usr/lib/xymon/server/bin/xymond ] ; then
 
83
                log_action_msg "Xymon server installed. Please restart 'xymon' instead"
 
84
                exit 0
 
85
        fi
 
86
        $0 stop
 
87
        sleep 1
 
88
        $0 start
 
89
        ;;
 
90
  reload|force-reload)
 
91
        [ -x /usr/lib/xymon/server/bin/xymond ] && exit 0
 
92
        create_includefiles
 
93
        kill -HUP `cat /var/run/xymon/clientlaunch.pid`
 
94
        ;;
 
95
  rotate)
 
96
        for PIDFILE in /var/run/xymon/*.pid
 
97
        do
 
98
                test -e $PIDFILE && kill -HUP `cat $PIDFILE`
 
99
        done
 
100
        ;;
 
101
  *)
 
102
        N=/etc/init.d/$NAME
 
103
        echo "Usage: $N {start|stop|restart|force-reload|status|rotate}" >&2
 
104
        exit 1
 
105
        ;;
 
106
esac
 
107
 
 
108
exit 0
 
109