~anjan/mnc

find seconds to next cronjob
3c887e23 — Martin Vahlensieck 2 months ago
Remove goroutine
Do not invoke crontab, read input from stdin instead. Recoded the awk trick in Go.
seed with a large number that pinephone can handle

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.