From 19503ef85ebce1fc76d33af29900e6df9c32c663 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Mon, 1 Aug 2022 21:43:35 -0500 Subject: [PATCH] avoid concurrent processes --- brightness-by-daylight.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/brightness-by-daylight.sh b/brightness-by-daylight.sh index 781cf2f..4abb83b 100644 --- a/brightness-by-daylight.sh +++ b/brightness-by-daylight.sh @@ -19,7 +19,10 @@ # it might also be a good idea to add ' scheduler' to your DE's autostart list, or to '.profile' so that it launches on system login # (sometimes I forget to turn on the monitor when I start my PC, so this is better than having a crontab) -# location of the config file +# avoid running two concurrent processes +[ "${BRTNESSLOCKER}" != "running" ] && exec env BRTNESSLOCKER="running" flock -en "/tmp/brightness-by-daylight" "$0" "$@" || : + +# set location of the config file [ -z "$XDG_CONFIG_HOME" ] && confdir="/home/sintan/.config" || confdir="$XDG_CONFIG_HOME" # read from the config file