- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to know when a background task has finished?
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
07-23-2003 01:21 PM
07-23-2003 01:21 PM
Does anybody know how to determine if a background task is still running from a shell script?
TIA,
Kris
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2003 01:24 PM
07-23-2003 01:24 PM
Re: How to know when a background task has finished?
2) ps -ef | grep -v grep | grep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2003 01:27 PM
07-23-2003 01:27 PM
Solutione.g.
mychild.sh &
CHILDPID=${!}
...
...
...
kill -s 0 ${CHILDPID} 2>/dev/null
STAT=${?}
if [[ ${STAT} -eq 0 ]]
then
echo "Child is still alive"
else
echo "It ain't"
fi
Plan B.
wait ${CHILDPID}
The parent will block until the designated child completes or
wait
the parent will block until all child processes have finished.
Plan C.
Just before the child process exits, have the child send a signal to the parent that the parent traps. This will allow the parent to continue processing asynchronously.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2003 10:59 PM
07-24-2003 10:59 PM
Re: How to know when a background task has finished?
start_background_task
alive=`jobs -l | grep $! | wc -l`
if [ $alive -ne 1 ]
then
cleanup_after_bg_task
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2003 01:38 PM
07-28-2003 01:38 PM
Re: How to know when a background task has finished?
nohup scriptname & | mailx -s "job" me@my.net
the email will be delivered at job completion.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com