Commit 6ef1e95d authored by yorn's avatar yorn

Various fixes to RHEL/LSB initscript

Rename RHEL to LSB (at least SuSE and RHEL+CentOS+SL)
Detect and load correct LSB-functions file, or exit with comprehensible error
Fix usage of pidofproc command, which requires the path of the process
parent c4b48616
...@@ -44,7 +44,7 @@ vendor-clean: ...@@ -44,7 +44,7 @@ vendor-clean:
$(MAKE) -C vendor/zeromq/ clean $(MAKE) -C vendor/zeromq/ clean
$(MAKE) -C vendor/zlib/ clean $(MAKE) -C vendor/zlib/ clean
rpm: OS=rhel rpm: OS=lsb
deb: OS=debian deb: OS=debian
rpm deb: PREFIX=/usr/local/logstash-forwarder rpm deb: PREFIX=/usr/local/logstash-forwarder
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
# Required-Stop: $remote_fs $syslog # Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Short-Description: Example initscript # Short-Description: UNINETT LAaaS Log Shipper LSB
# Description: This file should be used to construct scripts to be # Description: Ship logfiles to the UNINETT LAaaS service
# placed in /etc/init.d.
### END INIT INFO ### END INIT INFO
# Author: Jordan Sissel <jordan.sissel@dreamhost.com> # Author: Jordan Sissel <jordan.sissel@dreamhost.com>
# Author: Jørn Åne de Jong <jorn.dejong@uninett.no>
# PATH should only include /usr/* if it runs after the mountnfs.sh script # PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin PATH=/sbin:/usr/sbin:/bin:/usr/bin
...@@ -23,7 +23,15 @@ SCRIPTNAME=/etc/init.d/$NAME ...@@ -23,7 +23,15 @@ SCRIPTNAME=/etc/init.d/$NAME
LOGFILE=/var/log/$NAME.log LOGFILE=/var/log/$NAME.log
[ -r /etc/default/$NAME ] && . /etc/default/$NAME [ -r /etc/default/$NAME ] && . /etc/default/$NAME
. /etc/rc.d/init.d/functions if [[ -f /lib/lsb/init-functions ]]; then
. /lib/lsb/init-functions
elif [[ -f /etc/init.d/functions ]]; then
. /etc/init.d/functions
else
echo "Linux LSB init function script or Redhat /etc/init.d/functions is required for this script."
echo "See http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptfunc.html"
exit 1
fi
COMMAND="cd /var/run; exec $DAEMON $DAEMON_ARGS" COMMAND="cd /var/run; exec $DAEMON $DAEMON_ARGS"
...@@ -33,7 +41,7 @@ do_start() { ...@@ -33,7 +41,7 @@ do_start() {
exit 1 exit 1
fi fi
if pidofproc -p "$PIDFILE" >/dev/null; then if pidofproc -p "$PIDFILE" "$DAEMON" >/dev/null; then
exit 0 exit 0
fi fi
......
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