From e909ec779a23d80abc8fdfcfc4f9c01cb7c77c32 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Wed, 27 Jul 2022 23:13:56 -0500 Subject: [PATCH] bug fixing --- brightness-by-daylight.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/brightness-by-daylight.sh b/brightness-by-daylight.sh index 1cd6895..30a051b 100644 --- a/brightness-by-daylight.sh +++ b/brightness-by-daylight.sh @@ -30,6 +30,9 @@ else exit fi +# sometimes we need to wait a minute so that the next schedule is set up properly (or sunwait reports day/night in a misleading way) +[ "$2" == "wait" ] && echo "Waiting 60 seconds..." && sleep 60 + # get sun status sun_status=$(sunwait poll $latitude $longitude) [ $sun_status == "DAY" ] && target=$high || target=$low @@ -54,9 +57,6 @@ if [ "$1" == "scheduler" ]; then [ "$(at -c $item | sed 'x;$!d')" == "$scriptdir/brightness-by-daylight.sh scheduler wait" ] && flag=false done - # sometimes we need to wait a minute so that the next schedule is set up properly (or sunwait reports day/night in a misleading way) - [ "$2" == "wait" ] && sleep 60 - # actually create the schedule $flag && at -m $time_next <<< "$scriptdir/brightness-by-daylight.sh scheduler wait" fi \ No newline at end of file