SSH: Keep a long process running after disconnect

Dear Diary,

I did it again.

I SSH'd into one of my servers, and started a large sync operation.

It takes several hours every time.

Half way through the process, my Mac said:

A system update is ready. Your computer will now reboot to install it.

No "Cancel" button in sight. No "Maybe later" button. Only one button, one that said "Close".

From that day on, I made sure to always work inside a Tmux session.

Even if it was "just for a minute", I would open a Tmux session first, just in case.

Today I read this:

You know how you always start that mega long rsync in an ssh session from your laptop and then realize you have to go offline halfway through?

You forgot to start it in screen or nohup, didn't you?

You can pause it (ctrl+z), background it (bg), and then disown it so it is protected from SIGHUP when you quit your ssh session.

Bash (and, to be fair, zsh and others have copied much of this) has some wonderful job control features most people are completely oblivious of - even veterans of 20 years.

Hacker News: What's the one Linux command you wish you knew years ago?

It's about a tool called disown.

With disown, a process is removed from the list of jobs in the current interactive shell. Running jobs after starting a background process and running disown will not show that process as a job in the shell.

A disowned job will not receive a HUP from the shell when it exits.

StackExchange: Disown and Nohup