Sujet : Re: AI Written Bash Script
De : josef (at) *nospam* invalid.invalid (Josef Möllers)
Groupes : comp.sys.raspberry-piDate : 12. Dec 2024, 14:36:55
Autres entêtes
Message-ID : <ls077nFr9qnU2@mid.individual.net>
References : 1
User-Agent : Mozilla Thunderbird
On 12.12.24 13:43, DrStevenStrange wrote:
Ok - don't laugh
My coding skills are pitiful so I asked my resident Ai to write a bash script to call a webcam script (I did write this one) only between sunrise and sunset. it produced this and it works! My question is - how can I amend the script so it starts 30 minutes BEFORE sunrise and stops 30 Minutes after?
[...]
# Convert sunrise and sunset times to seconds since epoch
SUNRISE_EPOCH=$(date -d "$SUNRISE" +%s)
SUNSET_EPOCH=$(date -d "$SUNSET" +%s)
CURRENT_EPOCH=$(date +%s)
Since you already have the date/times in seconds since the epoch, just add/subtract 30 minutes worth of seconds for AFTER and BEFORE!
Josef