* Running emacs deamon outside login
@ 2010-01-21 15:35 ` Richard Lewis
2010-01-21 18:21 ` Suvayu Ali
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Richard Lewis @ 2010-01-21 15:35 UTC (permalink / raw)
To: help-gnu-emacs
On Linux, I've been wondering whether there's a good way to run emacs
deamon outside of my login process, so that I can log out and in again
and connect to the same emacs deamon process.
One sort of solution is running it using start-stop-deamon on Debian,
essentially as described on emacswiki:
http://www.emacswiki.org/emacs/EmacsAsDaemon#toc3
However, to get this to work I've had to hack it as I describe at the
bottom of that section (running emacs using su).
This may be more of a Linux question than an Emacs question, but does
anyone know of any better ways to do this? It's essentially just some
way to ensure that the emacs process stays alive when I log out.
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Richard Lewis
ISMS, Computing
Goldsmiths, University of London
Tel: +44 (0)20 7078 5134
Skype: richardjlewis
JID: ironchicken@jabber.earth.li
http://www.richard-lewis.me.uk/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+----------------------------------------------+
| Support open access to scholarship |
| http://freeculture.org/ http://www.doaj.org/ |
+----------------------------------------------+
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Running emacs deamon outside login
2010-01-21 15:35 ` Running emacs deamon outside login Richard Lewis
@ 2010-01-21 18:21 ` Suvayu Ali
2010-01-21 20:37 ` Richard Riley
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Suvayu Ali @ 2010-01-21 18:21 UTC (permalink / raw)
To: Richard Lewis; +Cc: help-gnu-emacs
On Thursday 21 January 2010 07:35 AM, Richard Lewis wrote:
> On Linux, I've been wondering whether there's a good way to run emacs
> deamon outside of my login process, so that I can log out and in again
> and connect to the same emacs deamon process.
>
> One sort of solution is running it using start-stop-deamon on Debian,
> essentially as described on emacswiki:
>
> http://www.emacswiki.org/emacs/EmacsAsDaemon#toc3
>
> However, to get this to work I've had to hack it as I describe at the
> bottom of that section (running emacs using su).
>
> This may be more of a Linux question than an Emacs question, but does
> anyone know of any better ways to do this? It's essentially just some
> way to ensure that the emacs process stays alive when I log out.
You don't need to do all that, logging out preserves the `emacs
--daemon'. Just use `emacsclient -ca=""' to connect to the daemon.
However I have seen another issue, it takes a long time to log out from
the session I started the daemon. However for subsequent sessions, the
login and logout is usual. I have seen this with XFCE and Gnome on two
different distros. (Xubuntu 9.04 and Fedora 11) I am yet to investigate
this in more detail.
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Running emacs deamon outside login
2010-01-21 15:35 ` Running emacs deamon outside login Richard Lewis
2010-01-21 18:21 ` Suvayu Ali
@ 2010-01-21 20:37 ` Richard Riley
[not found] ` <mailman.1886.1264098077.18930.help-gnu-emacs@gnu.org>
2010-01-22 3:04 ` Steve Revilak
3 siblings, 0 replies; 11+ messages in thread
From: Richard Riley @ 2010-01-21 20:37 UTC (permalink / raw)
To: help-gnu-emacs
Richard Lewis <richardlewis@fastmail.co.uk> writes:
> On Linux, I've been wondering whether there's a good way to run emacs
> deamon outside of my login process, so that I can log out and in again
> and connect to the same emacs deamon process.
>
> One sort of solution is running it using start-stop-deamon on Debian,
> essentially as described on emacswiki:
>
> http://www.emacswiki.org/emacs/EmacsAsDaemon#toc3
>
You dont need to do any of that. Start the daemon and thats it. It will
continue to be there and you could ssh in and connect for example.
While on the soapbox about how great the daemon is, I use this script
saved as "edit" and set my EDITOR to "edit":
,----
| #!/bin/bash
| # edit
| export GDK_NATIVE_WINDOWS=1
| exec emacsclient --alternate-editor="" -c "$@"
`----
The export is for a menu bug linked with GTK I think.
This call to emacsclient tells it to start the daemon if not already
done so - more distinguishing between if server is there or not.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Running emacs deamon outside login
[not found] ` <mailman.1886.1264098077.18930.help-gnu-emacs@gnu.org>
@ 2010-01-21 22:04 ` Richard Lewis
0 siblings, 0 replies; 11+ messages in thread
From: Richard Lewis @ 2010-01-21 22:04 UTC (permalink / raw)
To: help-gnu-emacs
At Thu, 21 Jan 2010 10:21:41 -0800,
Suvayu Ali wrote:
>
> On Thursday 21 January 2010 07:35 AM, Richard Lewis wrote:
> > On Linux, I've been wondering whether there's a good way to run emacs
> > deamon outside of my login process, so that I can log out and in again
> > and connect to the same emacs deamon process.
> >
> > One sort of solution is running it using start-stop-deamon on Debian,
> > essentially as described on emacswiki:
> >
> > http://www.emacswiki.org/emacs/EmacsAsDaemon#toc3
> >
> > However, to get this to work I've had to hack it as I describe at the
> > bottom of that section (running emacs using su).
> >
> > This may be more of a Linux question than an Emacs question, but does
> > anyone know of any better ways to do this? It's essentially just some
> > way to ensure that the emacs process stays alive when I log out.
>
> You don't need to do all that, logging out preserves the `emacs
> --daemon'. Just use `emacsclient -ca=""' to connect to the daemon.
>
Oh wow, that's very cool. Thanks.
> However I have seen another issue, it takes a long time to log out from
> the session I started the daemon. However for subsequent sessions, the
> login and logout is usual. I have seen this with XFCE and Gnome on two
> different distros. (Xubuntu 9.04 and Fedora 11) I am yet to investigate
> this in more detail.
>
Fortunately I haven't found that problem. I'm using just plain
metacity (no desktop environment).
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Richard Lewis
ISMS, Computing
Goldsmiths, University of London
Tel: +44 (0)20 7078 5134
Skype: richardjlewis
JID: ironchicken@jabber.earth.li
http://www.richard-lewis.me.uk/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+----------------------------------------------+
| Support open access to scholarship |
| http://freeculture.org/ http://www.doaj.org/ |
+----------------------------------------------+
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Running emacs deamon outside login
2010-01-21 15:35 ` Running emacs deamon outside login Richard Lewis
` (2 preceding siblings ...)
[not found] ` <mailman.1886.1264098077.18930.help-gnu-emacs@gnu.org>
@ 2010-01-22 3:04 ` Steve Revilak
2010-01-22 3:45 ` Richard Riley
3 siblings, 1 reply; 11+ messages in thread
From: Steve Revilak @ 2010-01-22 3:04 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1735 bytes --]
>From: Richard Lewis <richardlewis@fastmail.co.uk>
>Subject: Running emacs deamon outside login
>On Linux, I've been wondering whether there's a good way to run emacs
>deamon outside of my login process, so that I can log out and in again
>and connect to the same emacs deamon process.
>
>One sort of solution is running it using start-stop-deamon on Debian,
>essentially as described on emacswiki:
>
>http://www.emacswiki.org/emacs/EmacsAsDaemon#toc3
>
>However, to get this to work I've had to hack it as I describe at the
>bottom of that section (running emacs using su).
>
>This may be more of a Linux question than an Emacs question, but does
>anyone know of any better ways to do this? It's essentially just some
>way to ensure that the emacs process stays alive when I log out.
I hope you wont mind if I give more of a unix answer than an emacs
answer. :)
For the sake of simplicity, I'll assume that you want emacs to run
with your uid, and that you're content to start and kill the emacs
daemon on an as-need basis. If you can live with these assumptions,
then here is a simple recipie
nohup emacs --daemon </dev/null &
"nohup COMMAND" runs COMMAND, but arranges for sighup to be ignored.
This allows COMMAND to outlive the shell that started it.
Redirecting stdin from /dev/null will prevent your shell from hanging
when the shell exits.
This invocation should create a $HOME/nohup.out; nohup redirects
stdout and stderr to that file. If you don't want nohup.out, you can
redirect stdout and stderr yourself, like this
nohup emacs --daemon </dev/null >/dev/null 2>&1 &
Finally, these command lines use bash syntax. If you're using a
different shell, then you might have to adjust them slightly.
Steve
[-- Attachment #2: Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Running emacs deamon outside login
2010-01-22 3:04 ` Steve Revilak
@ 2010-01-22 3:45 ` Richard Riley
2010-01-23 19:38 ` Steve Revilak
0 siblings, 1 reply; 11+ messages in thread
From: Richard Riley @ 2010-01-22 3:45 UTC (permalink / raw)
To: help-gnu-emacs
Steve Revilak <steve@srevilak.net> writes:
> --0lnxQi9hkpPO77W3
> Content-Type: text/plain; charset=us-ascii; format=flowed
> Content-Disposition: inline
>
>>From: Richard Lewis <richardlewis@fastmail.co.uk>
>>Subject: Running emacs deamon outside login
>
>>On Linux, I've been wondering whether there's a good way to run emacs
>>deamon outside of my login process, so that I can log out and in again
>>and connect to the same emacs deamon process.
>>
>>One sort of solution is running it using start-stop-deamon on Debian,
>>essentially as described on emacswiki:
>>
>>http://www.emacswiki.org/emacs/EmacsAsDaemon#toc3
>>
>>However, to get this to work I've had to hack it as I describe at the
>>bottom of that section (running emacs using su).
>>
>>This may be more of a Linux question than an Emacs question, but does
>>anyone know of any better ways to do this? It's essentially just some
>>way to ensure that the emacs process stays alive when I log out.
>
> I hope you wont mind if I give more of a unix answer than an emacs
> answer. :)
>
> For the sake of simplicity, I'll assume that you want emacs to run
> with your uid, and that you're content to start and kill the emacs
> daemon on an as-need basis. If you can live with these assumptions,
> then here is a simple recipie
>
> nohup emacs --daemon </dev/null &
>
> "nohup COMMAND" runs COMMAND, but arranges for sighup to be ignored.
> This allows COMMAND to outlive the shell that started it.
>
> Redirecting stdin from /dev/null will prevent your shell from hanging
> when the shell exits.
>
> This invocation should create a $HOME/nohup.out; nohup redirects
> stdout and stderr to that file. If you don't want nohup.out, you can
> redirect stdout and stderr yourself, like this
>
> nohup emacs --daemon </dev/null >/dev/null 2>&1 &
>
> Finally, these command lines use bash syntax. If you're using a
> different shell, then you might have to adjust them slightly.
>
> Steve
>
Hi Steve.
I am confused as why any of this is necessary?
Th daemon doesn't need nohups. You dont need to run emacs --daemon and
you dont manually start the daemon if you dont want to (though "emacs
--daemon") will do just that. See my other post in this thread about my
EDITOR env.
The daemon already outlives any command shell that starts it - it ism
after all, a daemon.
regards
r.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Running emacs deamon outside login
2010-01-22 3:45 ` Richard Riley
@ 2010-01-23 19:38 ` Steve Revilak
2010-01-23 19:59 ` Richard Riley
2010-01-24 6:53 ` tomas
0 siblings, 2 replies; 11+ messages in thread
From: Steve Revilak @ 2010-01-23 19:38 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 813 bytes --]
> Subject: Re: Running emacs deamon outside login
srevilak> nohup emacs --daemon </dev/null >/dev/null 2>&1 &
rileyrgdev> Hi Steve.
rileyrgdev>
rileyrgdev> I am confused as why any of this is necessary?
Richard,
Let's go back to the original post.
OP> On Linux, I've been wondering whether there's a good way to run
OP> emacs deamon outside of my login process, so that I can log out
OP> and in again and connect to the same emacs deamon process.
OP> This may be more of a Linux question than an Emacs question, but
OP> does anyone know of any better ways to do this? It's essentially
OP> just some way to ensure that the emacs process stays alive when I
OP> log out.
I simply answered the more general question: "how do I keep a unix
process alive after I log out?".
Steve
[-- Attachment #2: Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Running emacs deamon outside login
2010-01-23 19:38 ` Steve Revilak
@ 2010-01-23 19:59 ` Richard Riley
2010-01-24 6:53 ` tomas
1 sibling, 0 replies; 11+ messages in thread
From: Richard Riley @ 2010-01-23 19:59 UTC (permalink / raw)
To: help-gnu-emacs
Steve Revilak <steve@srevilak.net> writes:
> --pWyiEgJYm5f9v55/
> Content-Type: text/plain; charset=us-ascii; format=flowed
> Content-Disposition: inline
> Content-Transfer-Encoding: quoted-printable
>
>> Subject: Re: Running emacs deamon outside login
>
> srevilak> nohup emacs --daemon </dev/null >/dev/null 2>&1 &
>
> rileyrgdev> Hi Steve.
> rileyrgdev>=20
> rileyrgdev> I am confused as why any of this is necessary?
>
> Richard,
>
> Let's go back to the original post.
>
> OP> On Linux, I've been wondering whether there's a good way to run
> OP> emacs deamon outside of my login process, so that I can log out
> OP> and in again and connect to the same emacs deamon process.
>
> OP> This may be more of a Linux question than an Emacs question, but
> OP> does anyone know of any better ways to do this? It's essentially
> OP> just some way to ensure that the emacs process stays alive when I
> OP> log out.
>
> I simply answered the more general question: "how do I keep a unix
> process alive after I log out?".
>
> Steve
Well, fair enough but the question was about Linux and the Emacs
daemon. And one doesn't have to do anything to keep it alive - certainly
not nohup - so I wondered if perhaps your answer might have confused. I
had wondered if there was any benefit in using nohup hence I asked why
the complicated approach when its not necessary.
cheers
r.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Running emacs deamon outside login
2010-01-23 19:38 ` Steve Revilak
2010-01-23 19:59 ` Richard Riley
@ 2010-01-24 6:53 ` tomas
2010-01-24 14:09 ` Steve Revilak
1 sibling, 1 reply; 11+ messages in thread
From: tomas @ 2010-01-24 6:53 UTC (permalink / raw)
To: Steve Revilak; +Cc: help-gnu-emacs
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sat, Jan 23, 2010 at 02:38:51PM -0500, Steve Revilak wrote:
>> Subject: Re: Running emacs deamon outside login
>
> srevilak> nohup emacs --daemon </dev/null >/dev/null 2>&1 &
[...]
> I simply answered the more general question: "how do I keep a unix
> process alive after I log out?".
It was instructive, yes, but note that processes designed to become a
daemon just do this nohup trickery (aka "detaching from the controlling
terminal") themselves. Emacs does, when started with the --daemon option.
In general it is better to do the last (whenever the program provides
such an option) since the program may want to do special things when run
in daemon mode (in Emacs, for example, there is the Lisp function
`daemonp', so you might take decisions in your .emacs initialization
file based on that).
Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFLW+6HBcgs9XrR2kYRAj32AJ0fi+eYVwZaDlQ0Puzh4UGFoepTZgCfS3on
OXWg+MpHT8VY/+Vx7R8pa4Y=
=E2tu
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Running emacs deamon outside login
2010-01-24 6:53 ` tomas
@ 2010-01-24 14:09 ` Steve Revilak
2010-01-25 5:32 ` tomas
0 siblings, 1 reply; 11+ messages in thread
From: Steve Revilak @ 2010-01-24 14:09 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 948 bytes --]
>> srevilak> nohup emacs --daemon </dev/null >/dev/null 2>&1 &
>> I simply answered the more general question: "how do I keep a unix
>> process alive after I log out?".
>From: tomas@tuxteam.de
>It was instructive, yes, but note that processes designed to become a
>daemon just do this nohup trickery (aka "detaching from the controlling
>terminal") themselves. Emacs does, when started with the --daemon option.
>
>In general it is better to do the last (whenever the program provides
>such an option) since the program may want to do special things when run
>in daemon mode
Fair enough.
I had interpreted the OP's remark
OP> On Linux, I've been wondering whether there's a good way to run
OP> emacs deamon outside of my login process, so that I can log out
OP> and in again and connect to the same emacs deamon process
As "emacs --daemon won't outlive my login process", but perhaps that
was the wrong interpretation.
Steve
[-- Attachment #2: Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Running emacs deamon outside login
2010-01-24 14:09 ` Steve Revilak
@ 2010-01-25 5:32 ` tomas
0 siblings, 0 replies; 11+ messages in thread
From: tomas @ 2010-01-25 5:32 UTC (permalink / raw)
To: Steve Revilak; +Cc: help-gnu-emacs
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sun, Jan 24, 2010 at 09:09:21AM -0500, Steve Revilak wrote:
[...]
> I had interpreted the OP's remark
[...]
> As "emacs --daemon won't outlive my login process", but perhaps that
> was the wrong interpretation.
I see.
Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFLXSz8Bcgs9XrR2kYRAmFiAJ4tK3BLhDxsrxVtE3XxaPghZVTB6gCfYqu1
mtn4M4NaWrIFJzvYxcPoaPI=
=r+My
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2010-01-25 5:32 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20100121164606.CDCD410AFB7@mxperim6.sea5.speakeasy.net>
2010-01-21 15:35 ` Running emacs deamon outside login Richard Lewis
2010-01-21 18:21 ` Suvayu Ali
2010-01-21 20:37 ` Richard Riley
[not found] ` <mailman.1886.1264098077.18930.help-gnu-emacs@gnu.org>
2010-01-21 22:04 ` Richard Lewis
2010-01-22 3:04 ` Steve Revilak
2010-01-22 3:45 ` Richard Riley
2010-01-23 19:38 ` Steve Revilak
2010-01-23 19:59 ` Richard Riley
2010-01-24 6:53 ` tomas
2010-01-24 14:09 ` Steve Revilak
2010-01-25 5:32 ` tomas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).