You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by de...@apache.org on 2017/08/18 16:52:21 UTC
[2/2] incubator-trafficcontrol git commit: handle orphan processes in
TO
handle orphan processes in TO
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/52e50b98
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/52e50b98
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/52e50b98
Branch: refs/heads/master
Commit: 52e50b98523902dab422117ca958655457f3de5f
Parents: 7073523
Author: Dan Kirkwood <da...@gmail.com>
Authored: Wed Aug 16 12:31:28 2017 -0600
Committer: Dewayne Richardson <de...@apache.org>
Committed: Fri Aug 18 10:52:09 2017 -0600
----------------------------------------------------------------------
traffic_ops/etc/init.d/traffic_ops | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/52e50b98/traffic_ops/etc/init.d/traffic_ops
----------------------------------------------------------------------
diff --git a/traffic_ops/etc/init.d/traffic_ops b/traffic_ops/etc/init.d/traffic_ops
index 01eef6f..53f6282 100755
--- a/traffic_ops/etc/init.d/traffic_ops
+++ b/traffic_ops/etc/init.d/traffic_ops
@@ -49,9 +49,10 @@ stopHypnotoad ()
echo -e "Shutting down Traffic Ops\n"
if [ -e $PIDFILE ]; then
_PID=`/bin/cat $PIDFILE`
- PID=`/bin/ps -ef|/bin/awk '/traffic_ops\/app\/script\/cdn/ {if ($3 == 1) {print $2}}'`
- if [[ ! -z $PID && $_PID = $PID ]]; then
- kill -term $PID
+ PIDS=( `/bin/ps -ef | /bin/awk '/traffic_ops\/app\/script\/cdn/ {if ($3 == 1) {print $2}}'` )
+ # Check if original is in pidfile, but kill any orphans, too..
+ if [[ " ${PIDS[@]} " =~ " $PID " ]]; then
+ kill -term "${PIDS[@]}"
fi
fi
}