I have the following situation :

As root Script_A.sh is run on the server and sleeps until triggered. When triggered, it calls Script_B.sh, which loops on the server to determine which actions it needs to perform. Once it generates its list of actions, it will submit Script_C.sh as the process owner (su - $sUser -c "/path/to/correct/script.sh").

My problem: is there a way to run the su - $sUser -c "/path/to/correct/script.sh" in background? I do not want to run the 3rd script sequentially.

2 Answers 2


It works fine for me to just put & at the end as usual:

su - "$sUser" -c "/path/to/script.sh" &

If that doesn't work for you you'll need to edit your question to include more details about your problem.


Appending an & to the command is the way to run a command in the background. So:

su - $sUser -c "/path/to/correct/script.sh" &

Or if you want to make sure the script won't receive a SIGHUP (hang up signal) from script B use disown

su - $sUser -c "/path/to/correct/script.sh" & disown

I'm not 100% sure that this is going to have the exact effect that you need, as there may be side-effects from using su. The nohup command is also useful for this type of endeavour, as it stops any output to the terminal, but it depends on your particular circumstances.

This answer has more clarification on the use of &, disown and nohup.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .