Let user exit program, while acquiring lock
This commit is contained in:
parent
8ebad1735b
commit
4ab2192d16
2
app/app
2
app/app
|
@ -10,9 +10,11 @@ mkdir -p "/run/$APP_NAME"
|
|||
exec 100>"/run/$APP_NAME/lock"
|
||||
set +e
|
||||
while true; do
|
||||
source "$APP_DIR/cmd/trap"
|
||||
if flock -e -n 100; then
|
||||
break
|
||||
fi
|
||||
source "$APP_DIR/cmd/untrap"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env bash
|
||||
trap - SIGINT SIGTERM SIGQUIT SIGHUP
|
Loading…
Reference in New Issue