Skip to content

Commit 119e43f

Browse files
authored
Better cleanup
1 parent 0059823 commit 119e43f

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

backups/backup.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ remove-lock() {
1313
rm -f "$LOCKFILE"
1414
}
1515

16-
trap remove-lock EXIT
16+
LOCAL_FILENAME=/tmp/nonexistingfile
17+
18+
cleanup() {
19+
remove-lock
20+
rm -f "$LOCAL_FILENAME"
21+
}
22+
23+
trap cleanup EXIT
1724

1825
flock -xn 100 || (
1926
log "Backup already running... exiting..."

0 commit comments

Comments
 (0)