- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to know when a background task is complete...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2004 09:08 AM
03-26-2004 09:08 AM
Inside a script, I start a another script in the background so I can continue processing. Is there a way besides ps to find out when this command has finished?
Thanks,
John
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2004 09:12 AM
03-26-2004 09:12 AM
Solutionmybackground.sh &
CHILDPID=${!}
Now all you have to do is periodically:
kill -0 ${CHILDPID}
STAT=${?}
if [[ ${STAT} -eq 0 ]]
then
echo "Kid is still going"
else
echo "Kid is dead"
fi
Man 1 kill for details.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2004 09:15 AM
03-26-2004 09:15 AM
Re: How to know when a background task is complete?
Have the child send a signal via kill to the parent process (using ${PPID}) just before the child terminates. The parent script, in turn, has a trap for the chosen signal. This is probably a better method because you no longer have to loop inside the parent checking on the status of the child.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2004 09:16 AM
03-26-2004 09:16 AM
Re: How to know when a background task is complete?
Alternatively, at some point of time, if you have to just wait on the background process you started to end, then you can use the wait command.
man wait for details
Sundar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2004 09:33 AM
03-26-2004 09:33 AM
Re: How to know when a background task is complete?
John