Commit 7bf2fc8a authored by Adam Wujek's avatar Adam Wujek 💬

rootfs: improve syslogd's init script

Use start-stop-daemon to start/stop syslogd daemon.
Distinguish between start-stop-daemon return value 0, 1 and the rest.
Fix syslog's pid filename (was /var/log/rsyslog.pid now is
/var/run/rsyslogd.pid).
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 5c26a28b
...@@ -17,9 +17,17 @@ start() { ...@@ -17,9 +17,17 @@ start() {
# Check the configuration file: if there's no target, don't run the thing. # Check the configuration file: if there's no target, don't run the thing.
if ! grep -q '^##.*remote-host' /etc/rsyslog.conf; then if ! grep -q '^##.*remote-host' /etc/rsyslog.conf; then
echo -n "Starting rsyslog: " echo -n "Starting rsyslog: "
/usr/sbin/rsyslogd start-stop-daemon -q -p /var/run/rsyslogd.pid -S \
start_counter --exec /usr/sbin/rsyslogd
echo "OK" ret=$?
if [ $ret -eq 0 ]; then
start_counter
echo "OK"
elif [ $ret -eq 1 ]; then
echo "Failed (already running?)"
else
echo "Failed"
fi
else else
echo "Not starting rsyslog: no target host selected" echo "Not starting rsyslog: no target host selected"
# avoid SNMPd complaints about lack of start counter file # avoid SNMPd complaints about lack of start counter file
...@@ -28,12 +36,15 @@ start() { ...@@ -28,12 +36,15 @@ start() {
} }
stop() { stop() {
if pidof rsyslogd > /dev/null; then echo -n "Stopping rsyslog: "
echo -n "Stopping rsyslog: " start-stop-daemon -K -q -p /var/run/rsyslogd.pid
start-stop-daemon -K -q -p /var/log/rsyslog.pid if [ $? -eq 0 ]; then
echo "OK" echo "OK"
else
echo "Failed"
fi fi
} }
restart() { restart() {
stop stop
start start
......
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