From df25f3be920d350763fd74a1e3af4d42439ad6a4 Mon Sep 17 00:00:00 2001 From: Pablo Cholaky Date: Mon, 19 Dec 2016 16:08:39 -0300 Subject: [PATCH] Allow /etc/init start after sigterm from system or user --- templates/default/redis.init.erb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/templates/default/redis.init.erb b/templates/default/redis.init.erb index f2e92bf9..e687616a 100644 --- a/templates/default/redis.init.erb +++ b/templates/default/redis.init.erb @@ -58,6 +58,14 @@ case "$1" in if [ -f $PIDFILE ] then echo "$PIDFILE exists, process is already running or crashed" + PIDNUM=`cat $PIDFILE` + PROCESS_RUNNING=`ps --no-headers -q $PIDNUM | wc -l` + if [ ! $PROCESS_RUNNING -eq 1 ] + then + echo "The PID doesn't exists, restarting it." + rm $PIDFILE + eval $EXEC + fi else echo "Starting Redis server..." eval $EXEC