Writing a dinit user service for the emacs daemon
Hello all,
I am attempting to write a dinit user service for the emacs daemon. What I have so far successfully starts the daemon, but then registers it as "stopped" even though it is running. I suspect that dinit is not receiving the correct PID after emacs forks itself.
Here are the contents of "~/.config/dinit.d/emacs" :
type = bgprocess
command = /usr/bin/emacs --daemon
restart = no
pid-file = ~/.emacs.d/emacs.pid
The pid-file "~/.emacs.d/emacs.pid" is generated by the following elisp in "~/.emacs.d/early-init.el" :
elisp
(with-temp-file "~/.emacs.d/emacs.pid"
(insert (number-to-string (emacs-pid))))
I am assuming that dinit reads the file before it has been updated, so it does not know to which PID emacs is actually running. Any suggestions?
Thank you!