• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

How to start an app within a SSH session and have it continue to run if I leave?

Red Squirrel

No Lifer
If I do something like:

./appname &

It runs in the background. yet, if I close the SSH console I ran that from, the app or script terminates. How do I make it so it does not terminate?

I had the impression it already worked that way, but it just so happened that the console I've been doing this stuff from always stayed open on my server. I accidentally closed it, and all hell broke loose. I can't seem to get everything started again without having to keep a SSH session active somewhere or restarting the whole server (all that stuff is in the rc.local file). Is there a way to do this?
 
I think you guys might be over-thinking it. It sounds like he just needs "nohup".
 
Interesting, I will give nohup that a try, thanks! Also forgot about the at command, that would work too.

Also through further experimenting I noticed if I do it with & and exit the console gracefully by typing exit, I'm ok. It's if I just X out of it.
 
I like tmux. Switched from screen, you can do a little more than screen but the main thing is the configuration is likely going to be far easier.

Code:
[SIZE="1"]set-option -g prefix C-a
bind-key C-a last-window
bind-key a send-prefix

set -g default-terminal "screen-256color"

set -g status-bg black
set -g status-fg white
set -g status-left-length 25
set -g status-right-length 50
set -g status-left '#[fg=green,dim][ #[fg=green,bold,nodim]#(whoami)#[fg=green,dim,nobold]@#[fg=green,bold,nodim]#H #[fg=green,dim,nobold]] #[default]'
set -g status-right '#[fg=green,dim][ #[fg=green,bold,nodim]#(cut -d " " -f 1-3 /proc/loadavg) #[fg=green,dim,nobold]] [ #[fg=green,bold,nodim]%Y-%m-%d %I:%M %p #[fg=green,dim,nobold]]'
set -g base-index 1

set-window-option -g utf8 on
set-window-option -g window-status-current-fg white
set-window-option -g window-status-current-format '#[fg=red,bold](#[fg=white,bold]#I:#W#F#[fg=red,bold])'
set-window-option -g window-status-fg green
set-window-option -g window-status-format '#I:#W#F'[/SIZE]
Code:
tmux -u new
Gets you a new tmux session.
Ctrl-A + D detaches you, then you can leave the ssh session.
Code:
tmux attach
Should be self explanatory 😛
 
Last edited:
Back
Top