2024-12-12 15:50 : id 405

This commit is contained in:
deadvey 2024-12-12 15:50:03 +00:00
parent 64c009f5e0
commit f277bd4f03

View File

@ -128,18 +128,13 @@ in
# Calculate the sunrise and sunset times for today using sunwait # Calculate the sunrise and sunset times for today using sunwait
sunrise_time=$(sunwait rise $LATITUDE $LONGITUDE | awk '{print $2}') sunrise_time=$(sunwait rise $LATITUDE $LONGITUDE | awk '{print $2}')
sunset_time=$(sunwait set $LATITUDE $LONGITUDE | awk '{print $2}') sunset_time=$(sunwait set $LATITUDE $LONGITUDE | awk '{print $2}')
echo $sunrise_time
echo $sunset_time
# Compare current time with sunrise and sunset times
if [[ "$current_time" > "$sunrise_time" && "$current_time" < "$sunset_time" ]]; then if [[ "$current_time" > "$sunrise_time" && "$current_time" < "$sunset_time" ]]; then
# It's daylight, run the "daytime" command
echo "It's daylight. Running daytime command..." echo "It's daylight. Running daytime command..."
# Replace the following line with the command you want to run during the day
/path/to/daytime_command
else else
# It's night, run the "nighttime" command
echo "It's night. Running nighttime command..." echo "It's night. Running nighttime command..."
# Replace the following line with the command you want to run during the night
/path/to/nighttime_command
fi fi
''; '';
executable = true; executable = true;