Background scripts

Normally when you close a terminal, including a Dataplicity terminal, your script will terminate too.
But what if you wanted to keep your scripts running even if you leave the terminal?

Enter tmux.

Firstly, install tmux:

sudo apt install -y tmux

Then make a tmux session that you will use:

tmux new -s MySession

When you create a new session you will automatically get attached to it.

All done! You are now within a tmux environment that you can leave and log back into whenever you want to. The scripts that you launch within this environment will stay alive until you turn them off.


Session commands

To detach from a session use:

tmux detach

To re-attach to a session use:

tmux a -t MySession

To delete a session completly use:

tmux kill-session -t MySession