I am calling the expect script from bash script inside for loop using multithreading in it. The expect script does ssh login and call python script using nohup command for restarting host. But, after completing the restart, the control not returned to the bash script.
Shell script code:
for host in ${hosts[@]};
do
./b.exp $id $pswd $host &
done
wait
echo "Completed"
Expect script code:
set timeout -1
spawn ssh <server login>
send "nohup /loc/c.py $host\r"
send -- "exit\r"
expect eof
I am expecting after all the hosts restart completion, the script should print "Completed". But, it is not printing anything and I need to manually exit the execution.
Could someone please tell what wrong I am doing here?