Commit 4a9cc03f authored by Jørn de Jong's avatar Jørn de Jong

Add RHEL support

parent c83cb4f4
......@@ -44,12 +44,15 @@ vendor-clean:
$(MAKE) -C vendor/zeromq/ clean
$(MAKE) -C vendor/zlib/ clean
rpm: OS=rhel
deb: OS=debian
rpm deb: PREFIX=/opt/logstash-forwarder
rpm deb: | build-all
fpm -s dir -t $@ -n logstash-forwarder -v $(VERSION) \
--replaces logstash-forwarder \
--after-install logstash-forwarder.postinst \
--after-remove logstash-forwarder.remove \
--after-install logstash-forwarder.$(OS).postinst \
--after-remove logstash-forwarder.$(OS).remove \
--exclude '*.a' --exclude 'lib/pkgconfig/zlib.pc' \
--description "a log shipping tool" \
--url "https://github.com/elasticsearch/logstash-forwarder" \
......@@ -59,7 +62,7 @@ rpm deb: | build-all
logstash-forwarder.conf=/etc/logstashforwarder/config.json.example \
logstash-forwarder.default=/etc/default/logstash-forwarder \
logstash-forwarder.logrotate=/etc/logrotate.d/logstash-forwarder \
logstash-forwarder.init=/etc/init.d/logstash-forwarder
logstash-forwarder.$(OS).init=/etc/init.d/logstash-forwarder
# Vendor'd dependencies
# If VENDOR contains 'zeromq' download and build it.
......
#! /bin/sh
### BEGIN INIT INFO
# Provides: logstash-forwarder
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
### END INIT INFO
# Author: Jordan Sissel <jordan.sissel@dreamhost.com>
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="log shipper"
NAME=logstash-forwarder
DAEMON=/opt/logstash-forwarder/bin/logstash-forwarder
DAEMON_ARGS="-config /etc/logstashforwarder/config.json -spool-size 100 -log-to-syslog"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
LOGFILE=/var/log/$NAME.log
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
. /etc/rc.d/init.d/functions
COMMAND="cd /var/run; exec $DAEMON $DAEMON_ARGS"
do_start() {
if [ -z "$DAEMON" ]; then
echo "not found - $DAEMON"
exit 1
fi
if pidofproc -p "$PIDFILE" >/dev/null; then
exit 0
fi
exec $DAEMON $DAEMON_ARGS >> $LOGFILE 2>&1 < /dev/null &
RETVAL=$?
local PID=$!
usleep 500000
echo $PID > $PIDFILE
}
do_stop()
{
killproc -p $PIDFILE $DAEMON
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${PIDFILE}
}
case "$1" in
start)
echo "Starting $DESC" "$NAME"
do_start
;;
stop)
echo "Stopping $DESC" "$NAME"
do_stop
;;
status)
echo -n "Status of $DESC"
status -p $PIDFILE
exit $?
;;
restart|force-reload)
echo "Restarting $DESC" "$NAME"
do_stop
do_start
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:
#! /bin/sh
chkconfig --add logstash-forwarder
service logstash-forwarder restart
#! /bin/sh
service logstash-forwarder stop
chkconfig --del logstash-forwarder
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment