[Top][All Lists]

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

Re: How to run --daemon in foreground?

From: Jean Louis
Subject: Re: How to run --daemon in foreground?
Date: Mon, 31 Oct 2016 07:47:28 +0200

Dear Bob,

Thank you for the suggestions.

On Sun, Oct 30, 2016 at 05:50:37PM -0600, Bob Proulx wrote:
> Jean Louis wrote:
> > I wish to run emacs --daemon, that it stays in foreground. The daemon
> > sometimes quits, and I wish to supervise it by using so
> > excellent s6-rc service manager, to run emacs as user, and to restart
> > it whenever necessary:

>   screen -S emacs -d -m -- emacs -f server-start
>     # -S emacs -- session name, give a meaningful name to session
>     # -d -m -- Start screen in "detached" mode. This creates a new
>                session but doesn't attach  to  it.  This  is  useful
>              for  system startup scripts.
>     # emacs -f server-start -- launch emacs and call function
> After starting emacs in this detached screen session then you can
> attach to the running emacs server as you describe.

Yes, I have tried with many options of screen, and now with your help,
I have found the right solution. Screen is not allowed to detach, that
way the supervision system s6-rc keeps it well in background. Emacs
daemon is sometimes crashing, and now I have solution to turn it on in
background, when the directory ~/Work is available. It means, when
encrypted partition gets mounted.

And with su - admin, I give to emacs the environment to run
with, even I would like to give it just what is necessary, I don't
know what it needs yet.

System is now working, without thinking.

if { s6-test -d /home/data1/protected/Work }
su - admin -s /bin/bash -l -c "/usr/bin/screen -S emacs -D -m -- /usr/bin/emacs 
--user admin --chdir /home/data1/protected"

reply via email to

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