mirror of
https://codeberg.org/privacy1st/nix-git
synced 2024-11-25 22:35:03 +01:00
22 lines
521 B
Bash
22 lines
521 B
Bash
|
#!/usr/bin/env bash
|
||
|
set -eu -o pipefail
|
||
|
|
||
|
function handle_sigterm(){
|
||
|
printf '%s\n' 'Ignored SIGTERM' >&2
|
||
|
}
|
||
|
|
||
|
# Handle SIGTERM
|
||
|
trap 'handle_sigterm' TERM
|
||
|
|
||
|
printf '%s%s%s\n' 'START. Can be terminated with "kill -TERM ' "$$" '"'
|
||
|
while :; do
|
||
|
printf '%s\n' 'sleeping 10s'
|
||
|
sleep 10s
|
||
|
printf '%s\n' 'awoke from sleep'
|
||
|
done
|
||
|
printf '%s\n' 'END'
|
||
|
|
||
|
# When executing `kill -TERM $PID` in another terminal,
|
||
|
# the command `sleep 10s` continues.
|
||
|
# After it has finished, `Ignored SIGTERM` is printed and the endless loop continues.
|