Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

run script in the background

Status
Not open for further replies.

pavNell

Technical User
Sep 27, 2002
178
US
Hello, I'm trying to run a script in the backgroud from another script.

ex.

ScriptA.sh
#!/bin/sh

ScriptB.sh &

# end of script

When ran, ScriptB.sh does not run in the background. What am I doing wrong?

 
pavNell,

Is that your whole script? Try puttin a "sleep 10" after calling your second script. Mike
________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Is ScriptB in $PATH ? vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
Depending on a few vague factors, once your first script terminates, your shell may kill all child processes, which would include your second script.

My favorite way of backgrounding processes so they don't get killed like that is submitting them through &quot;at now&quot;.

After you've made sure that the suggestions above are not the problem, do &quot;echo scriptb | at now&quot; and there you go.
 
Try using nohup - scriptA finishing probably kills scriptB ...

ScriptA.sh
#!/bin/sh

nohup ScriptB.sh &

# end of script

Greg.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top