1
0
mirror of https://github.com/phusion/baseimage-docker.git synced 2026-03-26 04:18:46 +00:00

Syslog-ng start and stop, preserving stdout file descriptor

This commit is contained in:
Ryan Sundberg
2017-10-31 15:41:59 -07:00
parent d765626688
commit 18a10580e1
2 changed files with 49 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -e
# If /dev/log is either a named pipe or it was placed there accidentally,
@@ -7,4 +7,28 @@ set -e
if [ ! -S /dev/log ]; then rm -f /dev/log; fi
if [ ! -S /var/lib/syslog-ng/syslog-ng.ctl ]; then rm -f /var/lib/syslog-ng/syslog-ng.ctl; fi
/etc/init.d/syslog-ng start
PIDFILE="/var/run/syslog-ng.pid"
SYSLOGNG_OPTS=""
[ -r /etc/default/syslog-ng ] && . /etc/default/syslog-ng
syslogng_wait() {
if [ "$2" -ne 0 ]; then
return 1
fi
RET=1
for i in $(seq 1 30); do
status=0
syslog-ng-ctl stats >/dev/null 2>&1 || status=$?
if [ "$status" != "$1" ]; then
RET=0
break
fi
sleep 1s
done
return $RET
}
/usr/sbin/syslog-ng --pidfile "$PIDFILE" -F $SYSLOGNG_OPTS &
syslogng_wait 1 $?

View File

@@ -1,3 +1,24 @@
#!/bin/sh
#!/bin/bash
/etc/init.d/syslog-ng stop
PIDFILE="/var/run/syslog-ng.pid"
syslogng_wait() {
if [ "$2" -ne 0 ]; then
return 1
fi
RET=1
for i in $(seq 1 30); do
status=0
syslog-ng-ctl stats >/dev/null 2>&1 || status=$?
if [ "$status" != "$1" ]; then
RET=0
break
fi
sleep 1s
done
return $RET
}
kill $(cat "$PIDFILE")
syslogng_wait 0 $?