LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-12-2008, 03:17 AM   #1
TheIrish
Member
 
Registered: Oct 2003
Location: ITALY
Distribution: Debian, Ubuntu, Fedora
Posts: 137

Rep: Reputation: 15
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

Last edited by TheIrish; 11-12-2008 at 03:18 AM.
 
Old 11-12-2008, 11:36 PM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
passing variable from bash to perl in a bash script quadmore Programming 6 02-21-2011 04:11 AM
Strange if statement behaviour when using bash/bash script freeindy Programming 7 08-04-2008 06:00 AM
Bash script to create bash script jag7720 Programming 10 09-10-2007 07:01 PM
[bash] having trouble debugging this bash script. jons Programming 4 02-08-2007 06:51 AM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration