Linux nohup to launch multiple scripts using bash

I came across this useful command when I wanted to automate some of my scripts to launch openvpn, rsync etc using one command.

The problem I had when trying this is with HUP (hangup) signal that would prevent the execution of commands further to execute other scripts.

For example, I have commands like this in my bash script:

cd /media/root/WORKING;
terminator --working-directory=/media/root/WORKING;
openvpn /media/root/WORKING/OS*;

The first to commands gets executed and terminator launches with working directory mentioned.

OpenVPN works too, but remains in verbose mode (am I correct???). The process does not end until I exit the same. So my next commands to run scripts (that sync my folders on desktop using rsync).

Was looking for a solution and I can get any from Google. I found this command nohup. With nohup, my bash looks as below:

cd /media/root/WORKING;
openvpn /media/root/WORKING/OS* </dev/null &>/dev/null &
nohup bash /root/Desktop/c-programs/util/ </dev/null >/dev/null 2>&1 &
nohup bash /root/Desktop/c-programs/util/ </dev/null >/dev/null 2>&1 &
terminator --working-directory=/media/root/WORKING &

Reference: nohup, null device

Leave a Reply

Your email address will not be published. Required fields are marked *