Hi there,
I hope this message finds you well. I have been using an SSH client to connect to a remote server and run a daemon process. However, I noticed that when I disconnect from the SSH session, the daemon process is closed as well. I’m wondering if this is the expected behavior or if there might be something misconfigured on my end.
Here are some details regarding my setup:
Operating System: Manjaro GNOME
Connection Method: SSH
I have tried searching for information on this issue, but I haven’t been able to find a clear answer. Could you please help me understand if it is normal for the daemon process to be terminated when the SSH connection is closed? If so, is there any way to keep the process running even after disconnecting from the SSH session?
Thank you very much for your attention to this matter. I appreciate any guidance or suggestions you can provide.
Best regards
Additional information:
Manjaro GNOME Can’t work properly,
but Ubuntu is normal.
I checked the historical Topics, try to set the /etc/systemd/logind.conf.d/20- kill-user-processses.conf to NO, or removed this file. It’s not working.
when I disconnect from the SSH session, the daemon process is closed as well.
run app:
ps command:
pstree command:
my app code:
if appDaemon {
if util.IsWindows() {
return errors.New("daemon: Non-POSIX OS is not supported")
}
cntxt := &daemon.Context{
PidFileName: serverPidFile,
PidFilePerm: 0664,
LogFileName: serverLogFile,
LogFilePerm: 0640,
WorkDir: currentFolder,
Umask: 027,
Args: []string{"", "app", "start", "--daemon=true"},
}
child, err := cntxt.Reborn()
if err != nil {
return err
}
if child != nil {
fmt.Println("pid:", child.Pid)
fmt.Println("log:", serverLogFile)
return nil
}
defer cntxt.Release()
fmt.Println("daemon started")
if err := startAppServe(container, server); err != nil {
fmt.Println(err)
}
return nil
}


