How to start sbt as a daemon?

I tried nohup "sbt run" &

returns: nohup: failed to run command ‘sbt run’: No such file or directory

and tried:

nohup sbt run &
[2] 7897
# nohup: ignoring input and appending output to ‘nohup.out’

When I return to the carriage, waiting for the continuation of work, I get:

[2]+  Stopped                 nohup sbt run

How to start sbt as a daemon?

Update:

sbt run </dev/null &
[5] 8961

I think cd to one directory:

# cd ..

[5]+  Stopped                 sbt run < /dev/null  (wd: /home/sum)
(wd now: /home)

So, it starts as a daemon, but if I perform any actions, such as changing the dir, does it kill the process? How to save work?

+8
source share
4 answers

Looks like I sbtrequested input from your terminal. If you really don't need input (which probably happens when you run the program in the background), you can run it as follows:

sbt run </dev/null >output-file &

See this answer for more details .

EDIT

, . : sbt :

setsid nohup sbt run &

:

sbt - SIGTTOU. , . , strace -f sbt run &, sbt , :

[pid 16600] execve("/usr/bin/sh", ["sh", "-c", "stty -g < /dev/tty"], [/* 75 vars */] <unfinished ...>

, sbt , , /dev/tty .

+11

sbt -Djline.terminal=jline.UnsupportedTerminal run &

: https://github.com/sbt/sbt/issues/701

+2

oleg-andriyanov . ( )

Mirko Stocker, ML . https://groups.google.com/forum/#!topic/play-framework/ZgjrPgib0-8

# screen -d -m sbt run
0

tmux ( - ). , , "" "". https://www.linode.com/docs/networking/ssh/persistent-terminal-sessions-with-tmux/

1) SBT

sbt
run

2) tmux

ctrl+b (then release)
d

3) tmux ( tmux)

ctrl + b 
s

4)

$ tmux a

5)

$ tmux attach-session (your-session-number)
0

Source: https://habr.com/ru/post/1660998/


All Articles