Improved lockfile creation

This commit is contained in:
Sayantan Santra 2022-06-27 21:36:18 -05:00
parent 8d2295c38b
commit a12dc70eda
1 changed files with 2 additions and 1 deletions

View File

@ -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