From a12dc70eda4725321c85d9d30812fc5552253214 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Mon, 27 Jun 2022 21:36:18 -0500 Subject: [PATCH] Improved lockfile creation --- brightness-by-daylight.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/brightness-by-daylight.sh b/brightness-by-daylight.sh index a043eae..c67b9bf 100644 --- a/brightness-by-daylight.sh +++ b/brightness-by-daylight.sh @@ -31,10 +31,11 @@ if [ "$1" == "crontab" ]; then if test -f /tmp/brightness-crontab; then exit else - touch /tmp/brightness-crontab if [ $(sunwait poll $latitude $longitude) == "DAY" ]; then + echo "Waiting for sunset at" $(sunwait report 35.221050N 97.445938W | grep "Daylight:" | awk '{print $6}') > /tmp/brightness-crontab sunwait wait set offset 10 $latitude $longitude && ddcutil setvcp 10 40 else + echo "Waiting for sunrise at" $(sunwait report 35.221050N 97.445938W | grep "Daylight:" | awk '{print $4}') > /tmp/brightness-crontab sunwait wait rise offset 10 $latitude $longitude && ddcutil setvcp 10 70 fi rm /tmp/brightness-crontab