Background execution of a script

Hi All,

Have a script called FTPIN-xx.sh.
It does stuff and when all is done, it is to execute another.
However, I'd like to have it execute the second script in the background or in a fashion that would allow my script to complete without having to wait.

I'm robbing the command from how I set items in crontab just to maintain some consistancy, but anyways ...

I thought I might be able to do the following:

nice ksh -c "${MD_BATCH}/The2ndScript.sh ${UID} ${PWD} &" >> ${MD_BATCHLOG}/The2ndScript.log 2>&1
-- OR --
nice ksh -c "${MD_BATCH}/The2ndScript.sh ${UID} ${PWD}" >> ${MD_BATCHLOG}/The2ndScript.log 2>&1 &

But am not too sure what happens to STDOUT for The2ndScript when FTPIN-xx.sh completes.

Any suggestions/thoughts ??

Thanks in advance. :slight_smile:

Cheers,
Cameron

Try putting /bin/ksh at the start on The2ndScript.sh then you don't have to keep refering to it.

The stdout of the background process will go to the file, when the task finishes the file will be closed.

That's all that happens.

I personally would go for your 2nd form, I try and always put "&" at the very end of the line to avoid confusion.

Thanks for the reply porter.

#!/bin/ksh - is standard for all of my scripts, so that's a given (in my case anyways).

The second option is my preference too, though the first was after wondering about the STDOUT issue.

Thanks for your help porter - appreciate your opinion and the feedback.

Cheers,
Cameron