aboutsummaryrefslogtreecommitdiffstats
path: root/test/utils/catchsignal.sh
blob: 99be6d1966ebc43e33e43d6938b236fec1b95594 (plain) (blame)
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
#!/bin/bash
# This file is part of Firejail project
# Copyright (C) 2014-2023 Firejail Authors
# License GPL v2

_term() {
	echo "Caught Signal"
	echo 1
	sleep 1
	echo 2
	sleep 1
	echo 3
	sleep 1
	echo 4
	sleep 1
	echo 5
	sleep 1

	kill $pid
	exit
}

trap _term SIGTERM
trap _term SIGINT

echo "Sleeping..."

sleep inf &
pid=$!
wait $pid