help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Running emacs deamon outside login


From: Steve Revilak
Subject: Re: Running emacs deamon outside login
Date: Thu, 21 Jan 2010 22:04:46 -0500
User-agent: Mutt/1.5.19 (2009-01-05)

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: pgpO80CaCVATu.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]