I am trying to automate the establishment of a VPN connection that uses snx.
Was hoping someone could help figure out why in the below expect script, the spawned snx process just dies expect reaches 'expect eof'. If I run the below script and watch ps -auxef, I can see that the snx connection gets established, but then dies as soon as that line is reached.
#!/usr/bin/expect
log_user 0
send_user "attempting to establish vpn connection..."
spawn snx -s server.com -p 443 -u myuser
expect {
"Please enter your password:\n" {
send "password123\r"
expect eof
send_user "successful\n"
exit 0
}
eof {
send_user "vpn is already connected\n"
exit 0
}
}
The weird thing is that if I run the snx command manually and enter the password, it runs fine.
Another weird thing is this issue is only seen when I run it from an ssh session into a Fedora 17 box, however when I run on my local machine (Fedora 18), it runs 100% fine. Any ideas? Any help is appreciated!