Skip to content

Instantly share code, notes, and snippets.

@hughes
Created August 20, 2013 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hughes/6286975 to your computer and use it in GitHub Desktop.
Save hughes/6286975 to your computer and use it in GitHub Desktop.
/etc/init.d/kibana
#!/bin/sh
#
# chkconfig: 2345 70 40
# description: kibana startup script
# author: Matt Reid
# websites: http://themattreid.com
# license: GPL v2
# date: 2012-12-06
# version: 0000.1
#
KHOME="/opt/kibana"
KBIN="kibana-daemon.rb" #short name
KSRV="$KHOME/kibana-daemon.rb" #script to issue start/stop/etc commands
TMPDIR="/dev/shm"
LOGFILE="/var/log/messages.log"
which ruby > /dev/null
if [ $? -ne 0 ]; then
echo "Ruby cannot be found. Please install ruby or put in PATH."
exit 1;
fi
echo $KSRV
RETVAL=0
case "$1" in
start)
echo -n "Starting Kibana: "
#check to see if we're already running
pgrep -f ${KBIN} > /dev/null
RUNNING=$?
if [ $RUNNING -eq 0 ]; then
echo "[FAILED]"
echo
echo "Reason: kibana is already running."
RETVAL=1
exit 1;
fi
ruby $KSRV start
;;
stop)
echo -n "Shutting down Kibana: "
ruby $KSRV stop
RETVAL=$?
;;
restart|reload)
ruby $KSRV stop
ruby $KSRV start
RETVAL=$?
;;
status)
ruby $KSRV status
RETVAL=$?
;;
*)
echo "Usage: $0 {start | stop | restart | status}"
exit 1
esac
exit $RETVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment