LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-01-2009, 12:14 AM   #1
Poki
LQ Newbie
 
Registered: May 2009
Posts: 21

Rep: Reputation: 0
Hung script as a result of bg process


Hello Everybody,

I have been struggling with this issue for quite some time, and the resolution that I found isn't so pretty, it solved my problem, I wonder if somebody has a "prettier" idea.

scenario:

I have a script x on machine a that shh's to machine b, and invokes a script y.

I need in case of successful exit status of script y on machine b to return to my script x on machine a and do some more work on machine a.
so my script x waits for return status from script y.

now script y invokes 2 things, the first one runs as a bg process, the second is not a bg process.

the thing is that bg process didn't let me exit from the script, so i couldn't return to my script x. the script was hung although all the services were successful

this is the way that i found to solve it:

(nohup bgscript >/dev/null 2>&1 &) &
(nohup bgscript >/dev/null 2>&1 &) &

p.s.: here bgscript is the first thing that needs to be invoked


without "double backgrounding" the bg process, script y didn't exit


Anybody has a nicer way of doing it?


Waiting for your replies
Thank you all in advance

Last edited by Poki; 05-01-2009 at 12:16 AM.
 
Old 05-01-2009, 06:01 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,332
Blog Entries: 55

Rep: Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533
'at' is useful for handing off jobs.
 
  


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
How to check Process hung or not??? jbilla Linux - Server 13 08-09-2010 06:37 AM
Shell script to check process and restart if "hung" georage Programming 5 10-29-2008 08:10 PM
System Hung Process Checking ahpin Linux - Server 2 08-15-2006 02:27 AM
killing a hung up process with a script lockejr Linux - General 2 04-14-2006 12:40 AM
no result from running script cowardnewbie Programming 1 09-09-2001 08:26 PM


All times are GMT -5. The time now is 10:37 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration