move time calculation code to function
exit after absolute
remove globals, rename, and simplify
mnc (my next cron) opens the user's crontab and echos the time when the next cronjob will be ran.
This program is intended to run with rtcwake on mobile devices to determine when to wake up in time to run cron jobs.
go build mnc.go
Returns the number of seconds until the next cronjob is due, use with crontab -l
:
crontab -l | mnc
Mnc reads from stdin and supports only crontab-style input
A construction like this is used in Sxmo to wakeup the system when the next cronjob is due:
sxmoscreenlock.sh rtc "$(crontab -l | mnc)"
In this use case, make sure you run this command via st on the phone rather than over ssh.
Send support questions and patches to the mailing list: public inbox.
Please use git send-email and send a patch to my public inbox.