I have a background process to sync and index email. The two function calls in there,
(mail-index) are calls with
start-process. I then run the
mail-background function periodically with
The relevant code is:
(defun mail-background () (set-process-sentinel (mail-sync) (lambda (p e) (when (= 0 (process-exit-status p)) (mail-index))))) (run-with-timer 0 (* 5 60) 'mail-background)
There are two issues I have with this setup:
- I don't know how to monitor the timer, so I can see failures, when it stopped running, etc.
- When my computer (macOS) goes to sleep, sometimes the timer continues when I come back, and sometimes it has stopped, which brings me to the first point.
I'm sure there is a better way to do what I am doing, so any pointer on that appreciated. Or, I'd just like to know how I can monitor and restart the background processes that are being run with
run-with-timer as a first step.