I'm trying to set my hackintosh pc to turn on at every sunrise and to run iTunes as the macOS boots up using bash or AppleScript without 3rd-party apps. I reached the point in my script when I need some help to let iTunes autorun with system boot only after sunrise time, but not with every other boot or restart. For this I have sunrise time variable in bash script and would like to try to link it with the cron job or find any other solution to run iTunes at everytime changing sunrise time.
Here is my script code, which updates sunrise time from the specific website every hour and works fine with waking / turning on my hackintosh at sunrise time:
#!/bin/bash
# Downloading webpage which contains the current sunrise time for my timezone
curl -L timezone.ru/suncalc.php?tid=193 > ~/sunrise-time &&
# Parsing the sunrise time stamp from the downloaded file
sunrise=$(grep 'Восход</b>: ' ~/sunrise-time | grep -o '[0-9]:[0-9][0-9]:[0-9][0-9]') &&
# Setting mac wake-up/turinng-on time reading variable from the previous line
echo "SYSTEMPASSWORD" | sudo -S /usr/bin/pmset -a repeat wakeorpoweron MTWRFSU $sunrise
All I need now as I said is to run iTunes only when my hackintosh boots up after sunrise time, but not need to run it at any other time when system boots up or restarts.
I tried to use offered by l0b0 at
command with some attributes but with no luck, maybe I didn't understand the proper usage of it.
Thanks for your help!
at
command you've tried?at
or PowerManager don't work, or have you tried?