avoid concurrent processes

This commit is contained in:
Sayantan Santra 2022-08-01 21:43:35 -05:00
parent 6465b5e9a6
commit 19503ef85e
1 changed files with 4 additions and 1 deletions

View File

@ -19,7 +19,10 @@
# it might also be a good idea to add '<location-of-this-script> 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