File init.d-graylog-suse of Package graylog
#!/bin/sh
### BEGIN INIT INFO
# Provides: graylog
# 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: graylog node
# Description: Start graylog node
### END INIT INFO
SERVICE_NAME="Graylog Server"
# Check for existence of needed config file and read it
GRAYLOG_CONFIG=/etc/sysconfig/graylog
test -r $GRAYLOG_CONFIG || { echo "$GRAYLOG_CONFIG not existing";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
. $GRAYLOG_CONFIG
CMD_LINE=${GRAYLOGCTL_DIR}/graylogctl
. /etc/rc.status
# Reset status of this service
rc_reset
case "$1" in
start)
echo -n "Starting ${SERVICE_NAME}"
(mkdir -p $(dirname ${GRAYLOG_PID});chown ${GRAYLOG_USER}. $(dirname ${GRAYLOG_PID}))
/sbin/startproc -u $GRAYLOG_USER -s $CMD_LINE start
rc_status -v
;;
stop)
echo -n "Shutting down ${SERVICE_NAME} "
/sbin/killproc -TERM -p $GRAYLOG_PID
rc_status -v
;;
restart)
$0 stop
$0 start
rc_status
;;
reload)
echo -n "Reload service ${SERVICE_NAME} "
$0 restart
rc_status -v
;;
status)
echo -n "Checking for service ${SERVICE_NAME} "
/sbin/checkproc -p $GRAYLOG_PID $CMD_LINE
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload}"
exit 1
;;
esac
rc_exit