Created
February 1, 2016 17:51
-
-
Save austburn/af7073d98a8d7a907ea5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: kibana | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start daemon at boot time | |
# Description: Enable service provided by daemon. | |
### END INIT INFO | |
. /lib/lsb/init-functions | |
name="kibana" | |
kibana_bin="/opt/kibana/bin/kibana" | |
kibana_conf="/etc/kibana/default.yml" | |
kibana_log="/var/log/kibana/app.log" | |
pid_file="/var/run/$name.pid" | |
cwd=`pwd` | |
start () { | |
command="${kibana_bin} -- --config $kibana_conf --log-file $kibana_log" | |
log_daemon_msg "Starting $name" | |
if start-stop-daemon --start --quiet --oknodo -d /opt/kibana/ --pidfile "$pid_file" -b -m -N 19 --exec $command; then | |
log_end_msg 0 | |
else | |
log_end_msg 1 | |
fi | |
} | |
stop () { | |
log_daemon_msg "Stopping $name" | |
start-stop-daemon --stop --quiet --oknodo --pidfile "$pid_file" | |
} | |
status () { | |
status_of_proc -p $pid_file $kibana_bin $name | |
} | |
case $1 in | |
start) | |
if status; then exit 0; fi | |
start | |
;; | |
stop) | |
stop | |
;; | |
reload) | |
stop | |
sleep 2 | |
start | |
;; | |
restart) | |
stop | |
sleep 2 | |
start | |
;; | |
status) | |
status && exit 0 || exit $? | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart|reload|status}" | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment