~anjan/mnc

find seconds to next cronjob
move time calculation code to function
exit after absolute
remove globals, rename, and simplify

clone

read-only
https://git.sr.ht/~anjan/mnc
read/write
git@git.sr.ht:~anjan/mnc

You can also use your local clone with git send-email.

#mnc

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.

#Install

go build mnc.go

#Usage

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

#Use case

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.

#Support and patches

Send support questions and patches to the mailing list: public inbox.

Please use git send-email and send a patch to my public inbox.