Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: scripts/master/kill_pidfile.sh

Issue 1863083003: Revert of Send a SIGKILL to masters after 10 seconds if they don't exit from SIGTERM (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « masters/master-common-rules.mk ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/sh
2 # Copyright (c) 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 # Sends a SIGTERM to a process whose PID is read from a pidfile. Waits 10
7 # seconds for it to exit and then sends a SIGKILL.
8
9 set -e
10
11 pidfile="$1"
12
13 if [ -z "$pidfile" ]; then
14 echo "Usage: $0 pidfile"
15 exit 1
16 fi
17
18 if [ ! -e "$pidfile" ]; then
19 echo "Pidfile $pidfile does not exist"
20 exit 0
21 fi
22
23 pid=$(cat $pidfile)
24 pgid=$(ps h -o pgid= $pid | awk '{print $1}')
25
26 echo "Sending SIGTERM to PGID $pgid"
27 kill -TERM -$pgid
28
29 # Wait 10 seconds for it to exit.
30 for i in $(seq 100); do
31 if ! ps -p $pid > /dev/null; then
32 exit 0
33 fi
34 sleep 0.1
35 done
36
37 echo "Sending SIGKILL to PGID $pgid"
38 kill -KILL -$pgid
OLDNEW
« no previous file with comments | « masters/master-common-rules.mk ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698