On Thu, Mar 16, 2023 at 08:53:55AM +0100, Nicolas George wrote:
> cor...@free.fr (12023-03-16):
> >   nohup serve -s  /home/myUsername/workspace/xxx-frontend/build &
> 
> What Greg said. Plus:
> 
> Never use nohup. nohup should never have been invented, it is based on a
> complete lack of understanding of how sessions and control terminal
> work.
> 
> Instead:
> 
> - use setsid to detach the process from the session;
> 
> - explicitly redirect the input and outputs where you want them.

That assumes you want to detach the process from its session in the
first place.  It's NOT what you should do when running a managed
service, though.

With a managed service, you don't want ANY of the old legacy "I want
to run a daemon from an interactive shell and have it automatically
separate itself from the interactive session" rubbish.  You DON'T
want the daemon to fork a background child and abandon it.  You DON'T
want the daemon's output to be discarded, or automatically redirected
to some file.

The service manager needs the daemon to behave sensibly, at least in
systemd's "simple" case.  A single process, with output going to stdout
and/or stderr.  The manager will take care of grabbing the output and
logging it.

Reply via email to