mirror of
https://github.com/YunoHost-Apps/restic_ynh.git
synced 2024-09-03 20:16:22 +02:00
feat: Remove backup lock file on interruption
This commit is contained in:
parent
9db6bf1f92
commit
42c5eeb9a7
1 changed files with 9 additions and 0 deletions
|
@ -1,5 +1,14 @@
|
|||
#!/bin/bash
|
||||
LOCK_FILE=/tmp/{{ app }}_backup.lock
|
||||
EXIT_PROPERLY() {
|
||||
echo -e "\e[91m \e[1m" # Shell in light red bold
|
||||
echo -e "!!\n Caught an interruption signal, removing lock file...\n!!"
|
||||
echo -e "\e[22m" # Remove bold
|
||||
|
||||
rm $LOCK_FILE
|
||||
exit 1
|
||||
}
|
||||
trap EXIT_PROPERLY 1 2 3 6 15
|
||||
if [ -f "$LOCK_FILE" ];then
|
||||
echo "Backup already launched by process $(grep '.*' $LOCK_FILE), canceling this one" >&2
|
||||
exit 1
|
||||
|
|
Loading…
Add table
Reference in a new issue