LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 03-01-2012, 12:38 AM   #1
priyas
LQ Newbie
 
Registered: Feb 2012
Posts: 1

Rep: Reputation: Disabled
parent process to wait foe child process to comelet


Hi all,
I am new to unix and need some help.
I have two scripts lets say A.expect and B.sh needs to be executed.
I am executing B.sh from A.expect where B.sh has sleep command.
My problem is that when B.sh encounters the sleep command my A.expect starts executing and exits.
but my A.expect should execute only after completing B.sh.
Is there any solution to this problem without using sleep command in A.expect.
Thanks in advance.
 
Old 03-01-2012, 04:48 AM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
After briefly reading over your post, what you would want to use is the wait command. Have a look at the man page, and an example:
http://linux.die.net/man/2/wait
http://stackoverflow.com/questions/2...hild-processes

I would describe more precisely how to use it, but you did not provide us with your scripts. If you provide us with the needed information, then we will be able to better assist you.

Cheers,

Josh
 
Old 03-01-2012, 08:52 AM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,610
Blog Entries: 4

Rep: Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905
It might even be simpler. Read carefully man bash. (I said, carefully.)

Normally, when you execute a series of commands, bash will wait for that process to terminate before proceeding, although it provides the & suffix to allow for parallel execution. Normally, bash forks the child process, then goes to sleep waiting for it to finish so that it can reap the child and collect its ending status. If that's not happening for you, please provide us with an appropriate excerpt of your actual script.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
killng parent process without killing child process (Linux C programming) lettuce84@naver.com Linux - Newbie 3 07-24-2015 08:37 AM
Sending Signal from Child Process to Parent Process : Not getting desired output thelink123 Linux - General 4 10-26-2012 09:05 PM
Can a child process kill the parent process ? sree_ec Programming 8 11-20-2010 05:37 AM
child process usses same amount of ram as parent process socialjazz Programming 7 10-19-2006 05:48 PM
Bash Scripting - child process affecting parent process mthaddon Linux - General 1 05-02-2004 01:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 06:16 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