<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://dev1galaxy.org/extern.php?action=feed&amp;tid=6186&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / runit services : Trying to create an emacs service]]></title>
		<link>http://dev1galaxy.org/viewtopic.php?id=6186</link>
		<description><![CDATA[The most recent posts in runit services : Trying to create an emacs service.]]></description>
		<lastBuildDate>Tue, 05 Dec 2023 17:38:30 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: runit services : Trying to create an emacs service]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=45961#p45961</link>
			<description><![CDATA[<p>i had an issue with the service not opening a socket at reboot. I think maybe it has to do with the export XDG_RUNTIME_DIR=/run/user/1000.<br />Maybe is not set up until i log on ? In which case what should i do ? Try it as a user service ?</p>]]></description>
			<author><![CDATA[dummy@example.com (chomwitt)]]></author>
			<pubDate>Tue, 05 Dec 2023 17:38:30 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=45961#p45961</guid>
		</item>
		<item>
			<title><![CDATA[Re: runit services : Trying to create an emacs service]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=45778#p45778</link>
			<description><![CDATA[<p>Ok. Here is the run script that allows emacsclient to connect without a full &#039;socket&#039; name:</p><div class="codebox"><pre><code>#!/usr/bin/env /lib/runit/invoke-run
export HOME=/home/chomwitt
export XDG_RUNTIME_DIR=/run/user/1000
exec 2&gt;&amp;1
cd $HOME
exec chpst -u chomwitt:chomwitt  emacs --fg-daemon=chomwitt-emacsd</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (chomwitt)]]></author>
			<pubDate>Wed, 29 Nov 2023 16:38:00 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=45778#p45778</guid>
		</item>
		<item>
			<title><![CDATA[Re: runit services : Trying to create an emacs service]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=45762#p45762</link>
			<description><![CDATA[<p>I&#039;ve managed to start emacslient .</p><div class="codebox"><pre><code>$ lsof -c emacs
emacs   623 chomwitt    6u     unix 0x000000006612cb3d      0t0  1292858 /tmp/emacs1000/chomwitt-emacsd type=STREAM (LISTEN)
$ emacsclient -s /tmp/emacs1000/chomwitt-emacsd -c  .</code></pre></div><p>when started from the command line it uses a different &#039;socket&#039;.</p><div class="codebox"><pre><code>$ lsof -c emacs
emacs   27340 chomwitt    6u     unix 0x00000000d0fa297b      0t0  1696185 /run/user/1000/emacs/chomwitt-emacsd type=STREAM (LISTEN)
emacs   27340 chomwitt    4u     unix 0x00000000331e1ac8      0t0  1518638 type=STREAM (CONNECTED)</code></pre></div><p>My guess is that from command line emacs --fg-daemon=chomwitt-emacsd uses $XDG_RUNTIME_DIR<br />$ echo $XDG_RUNTIME_DIR <br />/run/user/1000</p><p>So i will try to make&#160; $XDG_RUNTIME_DIR visible to my /etc/sv/emacs/run script</p>]]></description>
			<author><![CDATA[dummy@example.com (chomwitt)]]></author>
			<pubDate>Wed, 29 Nov 2023 10:19:15 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=45762#p45762</guid>
		</item>
		<item>
			<title><![CDATA[runit services : Trying to create an emacs service]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=45761#p45761</link>
			<description><![CDATA[<p>I can start the emacs service and then start an emacs frame as a client with:</p><div class="codebox"><pre><code>$ emacs --fg-daemon=chomwitt-emacsd 
$ emacsclient --socket-name=chomwitt-emacsd

$ ps -aux | grep emacs
chomwitt   494  0.0  0.0   6692  2088 pts/0    S+   09:05   0:00 grep emacs
chomwitt 31778  0.0  0.2 679544 139624 pts/4   Sl+  Nov28   0:01 emacs --fg-daemon=chomwitt-emacsd</code></pre></div><p>Now i tried to create a service with:</p><div class="codebox"><pre><code>$ less /etc/sv/emacs/run 
#!/usr/bin/env /lib/runit/invoke-run
export HOME=/home/chomwitt
exec 2&gt;&amp;1
cd $HOME
exec chpst -u chomwitt:chomwitt /usr/bin/emacs --fg-daemon=chomwitt-emacsd </code></pre></div><p>And then i start the service with:</p><div class="codebox"><pre><code>$ sudo ln -s /etc/sv/emacs /etc/service/emacsd</code></pre></div><div class="codebox"><pre><code>$ ps -aux | grep emacs
root       622  0.0  0.0   2344  1040 ?        Ss   09:07   0:00 runsv emacsd
chomwitt   623  5.5  0.1 224348 110176 ?       S    09:07   0:00 /usr/bin/emacs --fg-daemon=chomwitt-emacsd
chomwitt   660  0.0  0.0   6692  2088 pts/0    S+   09:07   0:00 grep emacs</code></pre></div><p>But now triying to start a client i get a &#039;cant find the service&#039; error: </p><div class="codebox"><pre><code>$ emacsclient  --socket-name=chomwitt-emacsd -c
emacsclient: can&#039;t find socket; have you started the server?
emacsclient: To start the server in Emacs, type &quot;M-x server-start&quot;.
emacsclient: error accessing socket &quot;chomwitt-emacsd&quot;</code></pre></div><p>My sources that i initially based my effort:<br /><a href="https://salsa.debian.org/Lorenzo.ru.g-guest/runit-services" rel="nofollow">&#160; Lorenzo Puliti &#039;s&#160; &#160;runit-services </a><br /><a href="https://hristos.lol/blog/emacs-daemon-runit-service/" rel="nofollow">&#160; Emacs daemon as a runit service by&#160; Hristos N. Triantafillou </a><br />(Hristos has blogged <a href="https://hristos.lol/blog/emacs-daemon-runit-user-service/" rel="nofollow">also Emacs daemon as a runit &quot;user service&quot;</a> but<br />i decided to try first the option that it seems to me more common and simple and suit me since i dont share my computer)</p>]]></description>
			<author><![CDATA[dummy@example.com (chomwitt)]]></author>
			<pubDate>Wed, 29 Nov 2023 07:11:08 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=45761#p45761</guid>
		</item>
	</channel>
</rss>
