:: [DNG] (runit) Can emacs daemon bec…
Top Page
Delete this message
Reply to this message
Author: Alexandros Prekates
Date:  
To: Devuan emailing list (DNG)
Subject: [DNG] (runit) Can emacs daemon become a user service ?
I have started an effort to setup emacs as a daemon controlled by runit.
I have posted my initial effort in the forum (1) althought my thougths here
i think are more wellthougth of .

I managed to create a system wide service that runs ok using (2) as base.

/etc/sv/emacds$ ls
finish run supervise
------------- /etc/sv/emacsd/run -------------
#!/usr/bin/env /lib/runit/invoke-run
export HOME=/home/chomwitt
exec 2>&1

cd $HOME
exec chpst -u chomwitt:chomwitt emacs --fg-daemon=chomwitt-emacsd
------------------------------------------------

------------- /etc/sv/emacsd/finish -------------
#!/bin/sh
set -e

exec /lib/runit/finish-exec "$@"
------------------------------------------------

----------activate the emacd service -----------
$ sudo ln -s /etc/sv/emacsd /etc/service/emacsd
------------------------------------------------

---------- connect to the emacsd ---------------
emacsclient -c --socket-name=/tmp/emacs1000/chomwitt-emacsd
------------------------------------------------

-----------desktop integration------------------
I also ~$ sudo nano /usr/share/applications/emacsclient.desktop
adding where needed --socket-name=/tmp/emacs1000/chomwitt-emacsd
------------------------------------------------

So although i havent a complete runit service (no log) its working.
The main issue is that in a system wide service i have inserted
export HOME=/home/chomwitt and named the socket chomwitt-emacsd thus
tagging it as service to a certain user . Now although usually
i am the sole user of my machine that setup seems misfit.

So it seems logical to me at that point to have emacs as a user service.
But as mentioned in (4) that even if i set seperate runsvdir to start
for a user that would start before the user login. So emacs could not
used for example XDG_RUNTIME_DIR to create a per user socket.

So is it that runit does not support user services in a more
complete level or there is a way to have user services start per user login event ?





(1) https://dev1galaxy.org/viewtopic.php?pid=45961#p45961
(2) My sources that i initially based my effort:
    Lorenzo Puliti 's   runit-services  https://salsa.debian.org/Lorenzo.ru.g-guest/runit-services
    Emacs daemon as a runit service by  Hristos N. Triantafillou  https://hristos.lol/blog/emacs-daemon-runit-service/
(3) A hint in libera / #emacs  by <Viking667> to look at  $XDG_RUNTIME_DIR
(4) https://www.reddit.com/r/voidlinux/comments/ign1eu/how_to_initiate_peruser_runit_services_after_login/
(5) I used $ lsof -c emacs  or   $ ls -p PID