L
L
Leonid2022-03-01 19:24:03
linux
Leonid, 2022-03-01 19:24:03

How can I start a program with screen and exit without stopping it?

I'm building my entire application with terraform and AWS. Everything works as it should, but my backing is written in main.go and it needs to be launched somehow. I tried to prescribe in user_data ec2
screen -dm bash -c "go run cmd/main.go"
With the logic that the system will rise, root will run this command, end the session and the application will continue to work. But as a result, no session is created in screen. Is it possible somehow to run the file automatically through screen or other utilities so that it does not fall off when disconnected?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Nikolai Savelyev, 2022-03-01
@AgentSmith

It seems that through systemctl it can be done

P
pfg21, 2022-03-01
@pfg21

look at tmux in it "ctrl-b" "d" is
handy.

D
Drno, 2022-03-02
@Drno

Systemd
Cron
(bash ./myscript.sh &)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question