I needed to run a daily cron job on my PinePhone, but that turned out to be trickier than expected. How can you schedule a job to be run in the morning, when the phone is most likely asleep (suspended) at that time?
My solution (workaround?) was to have the cron job run every 10 minutes, checking if the job was already executed today and if not, run the actual job command. This check is pretty cheap and I don’t need to wake the phone up to run my job. All I need is to get the job executed “today, whenever you have the time”.
The Cron Limiter tool (crolim for short) is available in my snippets repository.
With this tool, the
crontab is as easy as:
*/10 * * * * crolim podget. Now my daily podcasts can be downloaded daily, when the phone is awake.