1
0
Fork 0
mirror of https://github.com/SinTan1729/random.git synced 2024-12-25 20:58:37 -06:00

Improved lockfile creation

This commit is contained in:
Sayantan Santra 2022-06-27 21:36:18 -05:00
parent 8d2295c38b
commit a12dc70eda

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