Closed bernd closed 9 years ago
The script has to wait until the old process is gone before starting the new one.
Use start-stop-daemon
.
--- graylog2-server 2014-06-20 07:13:21.000000000 -0700
+++ /etc/init.d/graylog2-server 2014-06-20 08:34:00.000000000 -0700
@@ -61,10 +61,11 @@
chown ${GRAYLOG2_USER}:${GRAYLOG2_USER} /var/run/graylog2
fi
if running ; then
- log_progress_msg "apparently already running"
+ [ "$VERBOSE" != no ] && log_progress_msg "apparently already running"
return 1
else
- su -s /bin/bash -c "nohup $DAEMON $DAEMON_ARGS >> /var/log/graylog2-server/console.log 2>&1 &" ${GRAYLOG2_USER} || return 2
+ start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --user $GRAYLOG2_USER \
+ --chuid $GRAYLOG2_USER --background --startas $DAEMON -- $DAEMON_ARGS
sleep 2
if running ; then
return 0
@@ -76,11 +77,9 @@
do_stop()
{
- if [ -s $PIDFILE ]; then
- kill `cat ${PIDFILE}` >/dev/null 2>&1
- fi
+ start-stop-daemon --stop --quiet --oknodo --user $GRAYLOG2_USER \
+ --retry=TERM/60/KILL/5 --pidfile $PIDFILE
rm -f $PIDFILE
- return "0"
}
case "$1" in
Fixed via c63ea89.
The
/etc/init.d/graylog2-server restart
command does not work for Debian. Also check all others.