hy,
I wrote a simple shell script to monitor (with Nagios) a SNX VPN function. Here the Code snippet:
testing=`ssh user@IP-address 'ls /etc/sysconfig/network-scripts/ifcfg-eth0'`
#echo $testing
if [ $testing = "/etc/sysconfig/network-scripts/ifcfg-eth0" > /dev/null 2>%1 ]; then
echo "VPN is working"
exit 0
else snx -s server -u user
exit 0
fi
As you could see if the VPN connection is establised I got a simple output text in Nagios. But when the VPN connection isn�t up and running I want to establise a connection with the command "snx -s server -u user".
Than I have to put in a Password manually
Check Point's Linux SNX
build 800007075
Please enter your password:
And there I run into problems. How could I automate such a login within the script? Any Ideas?
regards
Tommy