aboutsummaryrefslogtreecommitdiffstats
path: root/test/utils/catchsignal.sh
blob: de2c068b3601273e24d152c476ff8563104bf162 (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-2020 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