Sujet : Re: AI Written Bash Script
De : josef (at) *nospam* invalid.invalid (Josef Möllers)
Groupes : comp.sys.raspberry-piDate : 12. Dec 2024, 14:35:32
Autres entêtes
Message-ID : <ls0754Fr9qnU1@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?
[...]
SUNRISE_EPOCH=$(date -d "$SUNRISE" +%s)
SUNSET_EPOCH=$(date -d "$SUNSET" +%s)
CURRENT_EPOCH=$(date +%s)
Since you already have the date/time in seconds since the epoch, just subtract 30 seconds for BEFORE and add 30 seconds for AFTER
Josef