Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-13-2013
Registered User
 
Join Date: Feb 2013
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Shell script password input

hy,

I wrote a simple shell script to monitor (with Nagios) a SNX VPN function. Here the Code snippet:


Code:
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


Code:
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
Sponsored Links
    #2  
Old 02-13-2013
zazzybob's Avatar
Registered Geek
 
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,186
Thanks: 3
Thanked 23 Times in 22 Posts
You could do this with Expect (Expect - Expect - Home Page).
The Following User Says Thank You to zazzybob For This Useful Post:
tomies (02-13-2013)
Sponsored Links
    #3  
Old 02-13-2013
Registered User
 
Join Date: Feb 2013
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Thanks that works perfect for me...

regards tommy
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script to input encrpyted password into htdigest (Apache) xxxx Shell Programming and Scripting 0 01-25-2012 01:42 AM
password file as std input to script mpheine Shell Programming and Scripting 2 09-01-2011 04:45 PM
Input in shell script urug3170 Shell Programming and Scripting 2 06-18-2010 11:13 AM
how to change root password using shell script with standard password kurva Shell Programming and Scripting 2 02-25-2009 01:35 AM
Input to shell script castlerock Shell Programming and Scripting 3 04-03-2006 05:26 AM



All times are GMT -4. The time now is 01:38 AM.