How can I change the time at which “daily” Cron jobs run (or make a new custom schedule)? Lifeboat seems to default to 6:25AM, which is not a good time for me to auto-restart my app, and I can’t find a way to change it.
Lifeboat makes use of schedule folders that exist on the system:
/etc/cron.hourly
/etc/cron.daily
/etc/cron.weekly
/etc/cron.monthly
These folders are scheduled to run by /etc/crontab
. On Debian + Ubuntu you can just edit this file (which is super handy because we weren’t always able to do that).
If you would like help writing the schedule expression click the ( ? )
in Lifeboat and it opens up a handy tool I like, Crontab.guru.
You may choose to either adjust the schedule for the whole /etc/cron.daily/
folder or add your own custom schedule line to run just the reboot script (you will need to move it out of the schedule-folder after Lifeboat writes the script). I do think changing the whole daily folder would be the easier path.
and edit the /etc/crontab
file:
sudo nano /etc/crontab
Adjust the schedule as you choose, and “write Out” the file by pressing ctrl-o, press enter to use the same file path and overwrite. ctrl-x to eXit. (goofy emphasis mine to share how I remember these commands.)
Once the file is updated, a StackOverflow comment suggests we need to restart the cron service, so we can do that:
sudo systemctl restart cron.service
That should be it. Cron should be operating your schedule now.
Best wishes,
Tim
Success - AWS Lightsail makes it easy to SSH using their browser interface.
I did find that I had to close the server in Lifeboat and reopen it before the new time would appear when hovering over the “?” icon.