Hi All,
I checked most of the post to solve this problem. But, I
couldn't.
Here the script,
Which telnets to another server and run a script and it has to
wait for that script/process to complete.
Script:
#!/usr/bin/ksh
(sleep 5; echo "<uid>"; sleep 10; echo "<passwd>"; sleep 5; echo "<run
script>"; sleep 5;
echo "wait $!"; sleep 2; echo "exit"; sleep 5) | telnet <Server Name> >
tempfile 2> /dev/null
...
Explanation:
$! will give the process ID and with that process ID we can wait until
it completes using the wait on unix machines.
I don't want to do sleep .. want to wait until the process terminates.
OUTPUT:
It's able to login and exceute the <run script> and sleep for 5 sec.
But, it's not waiting (wait $!) for the script to run or process to
complete.
Request:
How can wait until the process terminates. not sleep 10 or sleep 100
only using
wait PID
Please, Help me to resolve this issue.
Thanks in advance,
an