Commit 6ef1e95d authored by Jørn Åne de Jong's avatar Jørn Åne de Jong

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:
$(MAKE) -C vendor/zeromq/ clean
$(MAKE) -C vendor/zlib/ clean
rpm: OS=rhel
rpm: OS=lsb
deb: OS=debian
rpm deb: PREFIX=/usr/local/logstash-forwarder
......
......@@ -5,12 +5,12 @@
# 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.
# Short-Description: UNINETT LAaaS Log Shipper LSB
# Description: Ship logfiles to the UNINETT LAaaS service
### END INIT INFO
# 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=/sbin:/usr/sbin:/bin:/usr/bin
......@@ -23,7 +23,15 @@ SCRIPTNAME=/etc/init.d/$NAME
LOGFILE=/var/log/$NAME.log
[ -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"
......@@ -33,7 +41,7 @@ do_start() {
exit 1
fi
if pidofproc -p "$PIDFILE" >/dev/null; then
if pidofproc -p "$PIDFILE" "$DAEMON" >/dev/null; then
exit 0
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