-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgistEndParentProcess.sh
More file actions
executable file
·63 lines (52 loc) · 1021 Bytes
/
gistEndParentProcess.sh
File metadata and controls
executable file
·63 lines (52 loc) · 1021 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
function current_millisecond_timestamp {
echo $(python3 -c 'import time; print(int(round(time.time() * 1000)))')
}
PROFILE_START_TIME=$(current_millisecond_timestamp)
readonly PROFILE_START_TIME
function elapsed_milliseconds {
local current_time=$(current_millisecond_timestamp)
echo "$1 $(($current_time - $PROFILE_START_TIME))"
}
MAIN_PROC=$$
#trap "elapsed_milliseconds 'TRAP'; kill -s SIGINT -1" 10
{
sleep 20
exit 1
} &
{
sleep 2
echo "SLEEP 2 DONE"
exit 1
} &
{
sleep 2.1
echo "SLEEP 2.1 DONE"
exit 1
} &
{
sleep 2.5
echo "SLEEP 2.5 DONE"
exit 1
} &
{
sleep 2.7
echo "SLEEP 2.7 DONE"
exit 1
} &
trap "elapsed_milliseconds 'TRAP'; exit 0" SIGINT SIGQUIT SIGTERM
{
sleep 1
#kill -s SIGINT -1
sleep 1 &
BACKGROUND_SLEEP_PROC_ID=$!
wait $!
elapsed_milliseconds 'After background sleep'
kill -s SIGINT -1
#kill $$
#kill -10 $MAIN_PROC
sleep 10
#exit 0
} &
sleep 3
elapsed_milliseconds 'FAILED';
exit 1