mirror of
https://github.com/SinTan1729/random.git
synced 2024-12-25 20:58:37 -06:00
Fix next schedule time
This commit is contained in:
parent
4b59864dde
commit
a9f46d468d
1 changed files with 4 additions and 3 deletions
|
@ -26,14 +26,15 @@ else
|
|||
exit
|
||||
fi
|
||||
|
||||
# Check if called by crontab as routine. If yes, start waiting,
|
||||
# Check if called by crontab as routine. If yes, create a schedule using `at`,
|
||||
# otherwise adjust brightness immediately
|
||||
|
||||
if [ "$1" == "crontab" ]; then
|
||||
if [ $(sunwait poll $latitude $longitude) == "DAY" ]; then
|
||||
at -m $(sunwait report 35.221050N 97.445938W | grep "Daylight:" | awk '{print $6}') <<< "ddcutil setvcp 10 40 && $scriptdir/brightness-by-daylight.sh crontab"
|
||||
# +1 minute is so that the next schedule is set up properly (or sunwait reports day/night in a misleading way)
|
||||
at -m $(sunwait report 35.221050N 97.445938W | grep "Daylight:" | awk '{print $6}') +1 minute <<< "ddcutil setvcp 10 40 && $scriptdir/brightness-by-daylight.sh crontab"
|
||||
else
|
||||
at -m $(sunwait report 35.221050N 97.445938W | grep "Daylight:" | awk '{print $4}') <<< "ddcutil setvcp 10 70 && $scriptdir/brightness-by-daylight.sh crontab"
|
||||
at -m $(sunwait report 35.221050N 97.445938W | grep "Daylight:" | awk '{print $4}') +1 minute <<< "ddcutil setvcp 10 70 && $scriptdir/brightness-by-daylight.sh crontab"
|
||||
fi
|
||||
else
|
||||
if [ $(sunwait poll $latitude $longitude) == "DAY" ]; then
|
||||
|
|
Loading…
Reference in a new issue