Execute multiple command using nohup

When we need to execute multiple commands using nohup, each command should be executed after the previous command.

For example. If you want to run a script that you’ve made and also run a command at the same time after you logout, you can use sh -c doing the following:

# nohup sh -c  ‘./script2.sh >result2 && ./cmd1 >result1’ &

To run this script you need to be in the folder where you have script2.sh file.

Hope this can help you.

Don’t forget to subscribe my newsletter.

Cheers

No Comments

Post a Comment