Run Bash script in background and exit terminal
To avoid exit signals propagating to child processes of the terminal and shell, run the command with nohup
, i.e.:
nohup cmd &
If you want to run a specific command or file every second or so in the background after exiting the terminal you could try this easy little thing;
nohup watch -n5 'bash script.sh' &
That would run scipt.sh every 5 seconds.