4 # description: RRD Tool cache daemon
10 # Default-Start: 2 3 5
12 # Description: Start RRD cache daemon
15 # Start only if PNP is enabled
16 .
###ROOT###/etc/omd/site.conf
17 if [ "$CONFIG_PNP4NAGIOS" == off
] ; then
27 # Read in tuning configuration of admin
28 CONFFILE
=$OMD_ROOT/etc
/rrdcached.conf
29 if [ -e "$CONFFILE" ] ; then
37 # Please do not touch the code below
38 CACHE_DIR
="###ROOT###/tmp/rrdcached"
39 JOURNAL_DIR
="###ROOT###/var/rrdcached"
40 SOCKET
="###ROOT###/tmp/run/rrdcached.sock"
41 PIDFILE
="###ROOT###/tmp/rrdcached.pid"
44 OPTS
="-w $TIMEOUT -z $RANDOM_DELAY -f $FLUSH_TIMEOUT -s $GROUP -m 660 -l unix:$SOCKET -p $PIDFILE -j $JOURNAL_DIR"
45 DAEMON
="###ROOT###/bin/rrdcached"
49 echo -n 'Starting rrdcached...'
50 if [ -e "$PIDFILE" ] ; then
52 if [ -n "$PID" ] && ps
$PID > /dev
/null
2>&1 ; then
53 echo "Already running."
56 echo "removing stale pid file..."
60 # make sure, directories are there (ramdisk!)
61 mkdir
-p $CACHE_DIR $RRD_DIR &&
66 echo -n 'Stopping rrdcached...'
67 PID
=$
(cat $PIDFILE 2>/dev
/null
)
68 if [ -z "$PID" ] ; then
70 elif kill "$PID" ; then
71 echo -n 'waiting for termination..'
73 while [ -d /proc
/$PID ] ; do
75 if [ $N -ge 20 ] ; then
76 echo "still running after 20 secs!"
92 echo -n 'Checking status of rrdcached...'
93 if [ -e "$PIDFILE" ] ; then
95 if [ -n "$PID" ] && ps
$PID > /dev
/null
2>&1 ; then
104 echo -n 'Triggering global flush of rrdcached...'
105 result
=$
(echo 'FLUSHALL' | unixcat ~
/tmp
/run
/rrdcached.sock
)
106 if [ "$result" = "0 Started flush." ] ; then
115 echo "Usage: $0 {start|stop|restart|reload|status}"