diff options
author | Sam Kleinman <samk@10gen.com> | 2015-06-24 15:23:57 -0400 |
---|---|---|
committer | Sam Kleinman <samk@10gen.com> | 2015-06-25 17:18:47 -0400 |
commit | a89a8c59dc663c6abcc96431bf4aa53343441e6a (patch) | |
tree | 08a2575ba18cd6e9335e0300a0061eb0652f162a /rpm | |
parent | 90755a6b354962e0e636a21d25481428717f4994 (diff) | |
download | mongo-a89a8c59dc663c6abcc96431bf4aa53343441e6a.tar.gz |
SERVER-18977: remove pidfiles only when process does not exist
Diffstat (limited to 'rpm')
-rwxr-xr-x | rpm/init.d-mongod | 12 | ||||
-rw-r--r-- | rpm/init.d-mongod.suse | 11 |
2 files changed, 10 insertions, 13 deletions
diff --git a/rpm/init.d-mongod b/rpm/init.d-mongod index aed7793d074..66b3c1d8486 100755 --- a/rpm/init.d-mongod +++ b/rpm/init.d-mongod @@ -76,8 +76,8 @@ stop() } restart () { - stop - start + stop + start } # Send TERM signal to process and wait up to 300 seconds for process to go away. @@ -104,12 +104,10 @@ mongo_killproc() kill -KILL $pid >/dev/null 2>&1 usleep 100000 - rm -f "${pid_file}" - - checkpid $pid + checkpid $pid # returns 0 only if the process exists local RC=$? - [ "$RC" -eq 0 ] && failure "${procname} shutdown" || success "${procname} shutdown" - RC=$((! $RC)) + [ "$RC" -eq 0 ] && failure "${procname} shutdown" || rm -f "${pid_file}"; success "${procname} shutdown" + RC=$((! $RC)) # invert return code so we return 0 when process is dead. return $RC } diff --git a/rpm/init.d-mongod.suse b/rpm/init.d-mongod.suse index 426f06aa104..11a12ba79bc 100644 --- a/rpm/init.d-mongod.suse +++ b/rpm/init.d-mongod.suse @@ -84,8 +84,8 @@ stop() } restart () { - stop - start + stop + start } # Send TERM signal to process and wait up to 300 seconds for process to go away. @@ -112,11 +112,10 @@ mongo_killproc() kill -KILL $pid >/dev/null 2>&1 usleep 100000 - rm -f "${pid_file}" - - checkproc -p "${pid_file}" ${procname} + checkproc -p "${pid_file}" ${procname} # returns 0 only if the process exists. local RC=$? - RC=$((! $RC)) + [ "$RC" -eq 0 ] || rm -f "${pid_file}" # remove the pidfile only if there is no process. + RC=$((! $RC)) # invert return code so we return 0 when process is dead. return $RC } |