upstream/openstack/python-gnocchi/centos/files/scripts/gnocchi-metricd.init
Angie Wang 71aaf7b58c Integrate gnocchi for OpenStack Telemetry
Add python-gnocchi and python-gnocchiclient.
Update in python-openstackclient:
 Remove the support of celiometer CLI extensions.
Update in python-ceilometer:
 Install ceilometer publisher instead of dispatcher.

Story: 2002825
Task: 22871
Depends-On: https://review.openstack.org/587279

Change-Id: I3b0dde2c8668f7e623bcf128a13010b26667d802
Signed-off-by: Don Penney <don.penney@windriver.com>
Signed-off-by: Jack Ding <jack.ding@windriver.com>
2018-07-31 18:15:07 -04:00

109 lines
2.2 KiB
Bash

#!/bin/sh
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# The right to copy, distribute, modify, or otherwise make use
# of this software may be licensed only pursuant to the terms
# of an applicable Wind River license agreement.
#
### BEGIN INIT INFO
# Provides: Gnocchi metricd
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Gnocchi metricd service
### END INIT INFO
RETVAL=0
DESC="gnocchi-metricd"
DAEMON="/usr/bin/gnocchi-metricd"
PIDFILE="/var/run/$DESC.pid"
CONFIGFILE="/etc/gnocchi/gnocchi.conf"
LOGFILE="/var/log/gnocchi/metricd.log"
start()
{
if [ -e $PIDFILE ]; then
PIDDIR=/proc/$(cat $PIDFILE)
if [ -d ${PIDDIR} ]; then
echo "$DESC already running."
return
else
echo "Removing stale PID file $PIDFILE"
rm -f $PIDFILE
fi
fi
echo -n "Starting $DESC..."
start-stop-daemon --start --quiet --background --pidfile ${PIDFILE} \
--make-pidfile --exec ${DAEMON} -- --config-file ${CONFIGFILE} \
--log-file ${LOGFILE}
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo "Gnocchi metricd started."
else
echo "Gnocchi metricd start failed."
fi
}
stop()
{
if [ ! -e $PIDFILE ]; then
echo "Gnocchi metricd already stopped."
return
fi
echo -n "Stopping $DESC..."
start-stop-daemon --stop --quiet --pidfile $PIDFILE
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo "Gnocchi metricd stopped."
else
echo "Gnocchi metricd stop failed."
fi
rm -f $PIDFILE
}
status()
{
pid=`cat $PIDFILE 2>/dev/null`
if [ -n "$pid" ]; then
if ps -p $pid &> /dev/null ; then
echo "$DESC is running"
RETVAL=0
return
else
echo "$DESC is not running but has pid file"
RETVAL=1
fi
fi
echo "$DESC is not running"
RETVAL=3
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload|reload)
stop
start
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|force-reload|restart|reload|status}"
RETVAL=1
;;
esac
exit $RETVAL