Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I have two AIX ksh scripts: script1.sh, script2.sh
Into script1.sh I make a call to script2.sh
. $HOME/script2.sh &
I want that script2.sh executes in background mode (child process of script1).
But I want that when script1 finish, script2 finish too. is that possible??
How do I have to make the call to script2 in order to finish when script2 finish.
Do I have to use signals to order script2 finishing???
Any advice will be greatly aprecciatted.
Nauj

One way would be to have script2.sh continue to watch for presence of the parent process ID:
parent=$PPID
while true
do
if [ $(ps -ef|awk '$2=="'$PPID'"'|wc -l) -eq 0 ] ; then
break
fi
sleep 3
done

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |