LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Not terminating bash script (https://www.linuxquestions.org/questions/programming-9/not-terminating-bash-script-682821/)

TheIrish 11-12-2008 03:17 AM

Not terminating bash script
 
Good day everyone,
I have a situation with a strange behaviour involving a shell script and two programs.
The (interesting part of the) script is:

$FULLAPPNAME -K $IDLICENZA <&4 >> $LOGFILE 2>&1 &
APP_ID=$!
wait
disconn $APP_ID >> $LOGFILE 2>&1
exit $?

Now, what I feel, and I'm not sure of, that in very rare occasions the program "disconn" is not invoked, as if the script terminated before the command.
Is it possible? I mean, assuming the bash is not crashing, could a special situation make the script exit like that? Or maybe I should just suspect "disconn" is not working properly?

Of course now I'll start some serious debugging, but I was curious to know if there's any specs I ignore...

Thanks In advance

pinniped 11-12-2008 11:36 PM

Is 'wait' interruptible or not? Unless you're sure that the shell is set up otherwise, 'wait' is likely to be interruptible; you will need to check its return value and execute it again if it was interrupted. Otherwise, 'disconn' will be executed much earlier than you think.


All times are GMT -5. The time now is 12:08 AM.