Created
February 20, 2014 08:11
-
-
Save aravindgv/9108925 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/sh | |
###BEGIN INIT INFO | |
#Provides: graylog2-‐web | |
#Required-‐Start:$network$named$remote_s $syslog | |
#Required-‐Stop:$network$named$remote_fs $syslog | |
#Short-‐Description:Graylog2 Web | |
#Description:Graylog2Web-‐Searchyour logs, create charts, send reports and be alerted when something happens. | |
###END INIT INFO | |
#Author: Aravind G V <[email protected]> | |
#Source function library. | |
./etc/rc.d/init.d/functions | |
#Pull in sysconfig settings | |
[ -‐f /etc/sysconfig/graylog2-‐web] && ./etc/sysconfig/graylog2-‐web | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
DESC="Graylog2 | |
Web" | |
NAME=graylog2-‐web | |
CMD=/opt/graylog2-‐web-‐interface/bin/graylog2-‐web-‐interface | |
PID_FILE=/opt/graylog2-‐web-‐interface/RUNNING_PID | |
CONF_FILE=/opt/graylog2-‐web-‐interface/conf/graylog2-‐web-‐interface.conf | |
SCRIPTNAME=/etc/init.d/$NAME | |
LOCKFILE=/var/lock/subsys/$NAME | |
GL_USER=graylog2 | |
RUN=no | |
#Exit if the package is not installed | |
[ ‐e"$CMD" ]||exit 0 | |
start(){ | |
echo -‐n $"Starting ${NAME}:" | |
daemon -‐user=$GL_USER \ | |
nohup $CMD -‐Dconfig.file=${CONF_FILE} > /var/log/graylog2-‐web.log 2>&1 | |
& | |
RETVAL=$? | |
echo | |
sleep 2 | |
[$RETVAL=0] | |
&& touch ${LOCKFILE} | |
return $RETVAL | |
} | |
stop() | |
{ | |
echo -‐n $"Stopping ${NAME}:" | |
killproc -‐p ${PID_FILE} -‐d 10 $CMD | |
RETVAL=$? | |
echo | |
[$RETVAL=0] && rm -‐f ${PID_FILE} && rm -‐f ${LOCKFILE} | |
return $RETVAL | |
} | |
case "$1"in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
status) | |
status -‐p ${PID_FILE} $NAME | |
RETVAL=$? | |
;; | |
restart|force-‐reload) | |
stop | |
start | |
;; | |
*) | |
N=/etc/init.d/${NAME} | |
echo "Usage: $N {start|stop|status|restart|force-‐reload}" >&2 | |
RETVAL=2 | |
;; | |
esac | |
exit | |
$RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment