screen or tmux
Sure you can start processes and have then run continuously by making use of a terminal multiplexer such as screen or tmux. Processes can continue to persist in a screen or tmux session, and you can connect/disconnect to either (screen or tmux) as needed.
backgrounding
You can run any process you like and then background it and then disconnect it from your current terminal using the command disown
.
$ disown -a
Additionally if you just want to start a process up and not have to background it and disown
it you can use the command nohup
.
$ nohup myexec &
When you exit the shell, myexec
will continue to be running.
Example
Start a fake process.
$ sleep 12345 &
[1] 24339
$
Make sure we can see it:
$ pgrep -f "sleep 12345"
24339
But it's still connected to our terminal:
$ jobs
[1]+ Running sleep 12345 &
So let's disown
it:
$ disown -a
$ jobs
$
See it's still running:
$ pgrep -f "sleep 12345"
24339
Now let's log out, and log back in. See it's still there:
$ pgrep -f "sleep 12345"
24339
You can kill this process any time using standard means:
$ pkill -HUP -f "sleep 12345"
$ pgrep -f "sleep 12345"
$
The above will send the signal HUP
to a process name matching the pattern "sleep 12345". Double checking shows that it's now gone.