mcron: Update currency.units

master
Pierre Neidhardt 2018-03-31 21:27:24 +05:30
parent 927bd28730
commit 3b429e3a32
2 changed files with 22 additions and 0 deletions

17
.config/cron/job.guile Normal file
View File

@ -0,0 +1,17 @@
;; -*- mode: Lisp; -*-
;; This cannot be let-bound within `job'.
(define currency-file (string-append (getenv "HOME") "/.cache/currency.units"))
(job
(lambda (current-time)
(let* ((seconds-in-a-day (* 60 60 24))
(currency-time (stat:mtime (stat currency-file))))
(if (< currency-time (- current-time seconds-in-a-day))
(next-second)
;; TODO: The following does not work while it should. Report upstream.
;; (next-hour-from (next-day) (list (tm:hour (localtime (current-time)))))
(+ (next-second) (- 86400 (- current-time currency-time))))))
;; A string is nicer than Scheme code for `mcron --schedule' output.
;; Other we could return '(system* "units_cur" currency-file)
(string-append "units_cur " currency-file))

View File

@ -88,6 +88,11 @@ fi
## Cask
appendpath "$HOME/.cask/bin"
## mcron
if command -v mcron >/dev/null 2>&1; then
mcron &
fi
## Last PATH entries.
appendpath "/usr/lib/surfraw"
appendpath "${HOME}/personal/games/launchers"