From 6465b5e9a657d7bdac464ae7d603cbdb34f60c30 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Sun, 31 Jul 2022 19:03:32 -0500 Subject: [PATCH] Make sure only one instance is running using flock --- impfilesbk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/impfilesbk b/impfilesbk index d02b0d9..f111248 100644 --- a/impfilesbk +++ b/impfilesbk @@ -2,6 +2,9 @@ # This script backs up some important stuff +# Run only one instance of this script at one time +[ "${BKLOCKER}" != "running" ] && exec env BKLOCKER="running" flock -en "/tmp/impfilesbk" "$0" "$@" || : + # Setup location for home and backup directory HMDIR="/home/sintan" BKDIR="/mnt/storage/sintan"