File influxdb.init of Package influxdb
#!/bin/sh
#
# /etc/init.d/influx
# and its symbolic link
# /(usr/)sbin/rcinflux
#
### BEGIN INIT INFO
# Provides: influx
# Required-Start: $syslog $remote_fs
# Should-Start: $time ypbind smtp
# Required-Stop: $syslog $remote_fs
# Should-Stop: ypbind smtp
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: InfluxDB database server
# Description: InfluxDB database server
### END INIT INFO
prog=influxdb
influxd=/usr/bin/influxd
pidfile="/var/run/influxdb/influxd.pid"
lockfile=/var/lock/subsys/influxd
. /etc/rc.d/init.d/functions
start() {
echo -n $"Starting $prog: "
daemon /usr/sbin/start-stop-daemon --start -b -u influxdb -g influxdb --exec $influxd -- -config /etc/influxdb/config.toml -pidfile ${pidfile}
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch ${pidfile}
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} ${prog}
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
return $RETVAL
}
restart() {
stop
start
}
rh_status() {
status -p ${pidfile} ${prog}
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
usage() {
echo "Usage: $0 {start|stop|status|restart}"
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 1
$1
;;
restart)
$1
;;
status)
rh_status
;;
usage)
$1
;;
*)
usage
exit 2
esac
exit $?