I have a Go script that creates an HTTP request and responds to any incoming requests. I want this script to run on a Linux server. However, I can't keep the ssh connection active forever, and when it disconnects the script also stops, as expected. I know that you have 'forever' for NodeJS that fixes this issue. I was wondering if something similar also exists for Golang, as I was not able to find anything. Any other tips on how to fix this are also very welcome.
Asked
Active
Viewed 362 times
0
-
2Does this answer your question? [How to make a program continue to run after log out from ssh?](/questions/954302), [How to prevent a background process from being stopped after closing SSH client in Linux](/questions/285015), [Getting ssh to execute a command in the background on target machine](/questions/29142) and several similar questions. – Steffen Ullrich Dec 26 '21 at 21:08
-
nohup ./yourprogram & – gipsy Dec 26 '21 at 21:08
-
1A go program cannot accurately be called a script, since they are compiled into a statically linked binary. The most straight forward solution to running a service on Linux is with an init script , or more likely today, a system d unit – erik258 Dec 26 '21 at 21:23
1 Answers
1
There are mainly three options here, one is to use the nohup command, the other is to use the screen command, and the last is the upgraded version of byobu of screen. After reading these three commands, I actually prefer to use the byobu command, because the byobu command is more powerful, an upgraded version of screen, and the interface is more friendly.

Conjure.Li
- 38
- 3