Learned it from here http://stackoverflow.com/questions/6168781/how-to-include-nohup-inside-a-bash-script They use it to make current script daemoned but you can also make scripts that you run from within a script daemoned

Instead of doing

or

which is 

NOTE: > whatever 2>&1  is the same as &> whatever  in bash4 and ahead

Interesting alteranative

You can use redirects and disown instead of nohup

or:

or if you want output:

You run process with /dev/null for input and output which unties it from output and input (you can give it some output if you want by modifying > or 2> or &>, just make sure to untie the input of stdin by doing </dev/null). Then we run it into background with &. Then we disown it (untie it from shell, so if shell turns off the process still runs).

The End

Leave a Reply

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