OpenSolaris Solaris Forum  
     

Left Nav Register FAQ Members List Default Password Members List Linux Commands Search Today's Posts Mark Forums Read Right Nav

Left Container Right Container
 

Go Back   OpenSolaris Solaris Forum » Solaris General

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-18-2011, 12:00 PM
Deepti
Guest
 
Posts: n/a
Default Shell script: get the exit status of a failed background child process in Solaris

I have written a POC .This code works fine in Linux but not in Solaris. I am using Solaris 10

#!/bin/sh
echo inside parent
echo executing child in the background
./remove deepti & # executing dummy command to make sure that background process fails
childpid=$!
i=0
while [ `ps -p $childpid >/dev/null; echo $?` = 0 ]; do
sleep 5
i=`expr $i + 1`
if [ $i -gt 3 ]; then
echo wait exceeded
ps -p $childpid >/dev/null
exit $?
fi
done
wait
$childpid
exit $?

I expect that Wait shall return me the exit status of background command . exit status should be 127 . However I get exit status as 0.
Reply With Quote
Sponsored Links

Reply

Bookmarks

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script for password prompt JDK Solaris General 3 11-24-2011 02:00 PM
Shell script Unregistered Solaris General 4 10-01-2010 03:39 PM
fd of a process showing sudden increase in count Unregistered Solaris General 0 09-06-2010 02:48 PM
UTF ERROR ["../../../src/solaris/npt/utf_md.c":49]: Failed to complete iconv_open() s Unregistered Solaris OpenSolaris Servers 0 05-12-2010 05:53 PM
Kill a process in solaris Unregistered Solaris General 1 01-25-2009 10:46 AM


All times are GMT. The time now is 01:56 PM.


Powered by vBulletin. Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.