09-23-2009
vpn connect/disconnect shell script
Hi
I am not so good in scripting..trying ot learn it...need guidance of the experts in shell scripting..
Let me explain the scenario first..
a server MX1 is connected to another server MX2[199.8.7.29] through vpn..every 5 minute a script runs to test vpn connectivity between the 2 servers.when the vpn goes down a mail is sent as notification from MX..here is the shell script i have written on MX1..
sleep 1
l=`nmap -P0 -p25 199.8.7.29`
echo $l > /var/log/vpncon.log && echo $l >> /var/log/monscrpt.log
grep -qi "open" /var/log/vpncon.log
j=`echo $?`
if [ $j -ne 0 ]; then
echo Partner VPN Failed >> /var/log/monscrpt.log && echo $l | mailx -s "Partner VPN Failed" 'aarti_sankhe@cactus.com'
fi
the scipt only sends an email when the vpn goes down..
my next task is when the vpn comes up i need to send a mail form this script hat the vpn is up now..
please suggest.
Thanks in advance..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
i'm connecting with ssh from a windows pc to a linux system. i want to start e.g. a download and close my session afterwards. how do i do this without killing the download?
thx in advance. (2 Replies)
Discussion started by: sTorm
2 Replies
2. Shell Programming and Scripting
Hello all, I know that is a question which has made too many times, and I have been looking into the threads but all posted was not sucessfully for me so...
I need a shell script which connect two unix servers, but NOT using ssh... Is there another way to do it?
I've tried ssh but it didn't... (1 Reply)
Discussion started by: Geller
1 Replies
3. Shell Programming and Scripting
Hi,
I want to connect to oracle db using unix shell script. And i want to retrieve data from db through shell script.
Please help me as soon as possible.
Thanks,
J.P. Das (1 Reply)
Discussion started by: jyotidas
1 Replies
4. Ubuntu
Hi all,
I am trying to configure and connect Cisco VPN on Ubuntu 10.04.
I've imported .pcf file. The new vpn conn appears in the VPN Connections option. Now when I select it, it doesn't connect. Nothing happens.
I am not able to connect to VPN at all. I tried using kvpnc as well but it... (10 Replies)
Discussion started by: morningSunshine
10 Replies
5. Shell Programming and Scripting
Guys,
I am trying to write a shell script that connect to wcsprod database and read the query
#!/bin/ksh
sqlplus -s < connect to wcsprod user wcsadm using pwd >
select * from catentry fetch first 1 row only with ur;
databse: wcsprod
user: wcsadm
pwd: pwd
thanks (1 Reply)
Discussion started by: skatpally
1 Replies
6. AIX
Hi,
I have a task requested by my boss to create a script to enable a server to connect to a vpn network and then to connect to another server to upload some data...
How can I connect to a vpn network from AIX server? via telnet? ssh?
I have tried to google but mostly the answers are... (1 Reply)
Discussion started by: mushr00m
1 Replies
7. Shell Programming and Scripting
Hi All,
Please see the below code.
it is working fine when in 'test_file' have only one emplid.
test_file contains only emplid and date, like below ...
0000221|1/12/2003
0000223|1/1/1996
Problem :-
when test_file contains more then one records(emplids) it is not giving any errors... (3 Replies)
Discussion started by: krupasindhu18
3 Replies
8. Shell Programming and Scripting
Dear Experts,
I am new to the shell scripting.
I am looking for a shell script to connect to one Unix/Linux server1 to other Unix/Linux server2 and trigger a SAP Event in that server2 (Which will trigger a job in SAP).
Is this possible to connect from one server to the other server securely... (7 Replies)
Discussion started by: Venu V Reddy
7 Replies
9. Shell Programming and Scripting
hello
i try to made a report to conect all database to diferent OS
HP-UX/LINUX/SOLARIS/AIX
this is my example
i have 5 db
OS are HP-UX
ps -fea | grep pmon
root 1120 1 0 Nov 29 ? 5:14 ipmon -sD
oracle 10286 1 0 Nov 29 ? 27:19 ora_pmon_BD1
oracle 10431... (7 Replies)
Discussion started by: ceciaide
7 Replies
10. Shell Programming and Scripting
Hi Guys,
I suspect what I'm trying to do isn't possible, but I'm hoping someone can either confirm this or point me in the right direction.
We have a third-party application which transfers a collection of files to our SFTP server ( Ubuntu 12.04 with OpenSSH ) . Once the app disconnects, we... (13 Replies)
Discussion started by: jamesdrinkwater
13 Replies
LEARN ABOUT SUSE
networkmanager
NETWORKMANAGER(8) System Manager's Manual NETWORKMANAGER(8)
NAME
NetworkManager - network management daemon
SYNOPSIS
NetworkManager [--no-daemon]
DESCRIPTION
The NetworkManager daemon attempts to make networking configuration and operation as painless and automatic as possible by managing the
primary network connection and other network interfaces, like Ethernet, WiFi, and Mobile Broadband devices. NetworkManager will connect
any network device when a connection for that device becomes available, unless that behavior is disabled. Information about networking is
exported via a D-Bus interface to any interested application, providing a rich API with which to inspect and control network settings and
operation.
NetworkManager will execute scripts in the /etc/NetworkManager/dispatcher.d
directory in alphabetical order in response to network events. Each script should be (a) a regular file, (b) owned by root, (c) not
writable by group or other, (d) not set-uid, (e) and executable by the owner. Each script receives two arguments, the first being
the interface name of the device just activated, and second an action.
up The interface has been activated. The environment contains more information about the interface; CONNECTION_UUID contains the UUID
of the connection. Other variables are IP4_ADDRESS_N where N is a number from 0 to (# IPv4 addresses - 1), in the format
"address/prefix gateway". IP4_NUM_ADDRESSES contains the number addresses the script may expect. IP4_NAMESERVERS contains a space-
separated list of the DNS servers, and IP4_DOMAINS contains a space-separated list of the search domains. Routes use the format
IP4_ROUTE_N where N is a number from 0 to (# IPv4 routes - 1), in the format "address/prefix next-hop metric", and IP4_NUM_ROUTES
contains the number of routes to expect. If the connection used DHCP for address configuration, the received DHCP configuration is
passed in the environment using standard DHCP option names, prefixed with "DHCP4_", like "DHCP4_HOST_NAME=foobar".
down The interface has been deactivated.
vpn-up A VPN connection has been activated. The environment contains the connection UUID in the variable CONNECTION_UUID.
vpn-down
A VPN connection has been deactivated.
hostname
The system hostname has been updated. Use gethostname(2) to retrieve it.
OPTIONS
The following options are supported:
--no-daemon
Do not daemonize. This is useful for debugging, and directs log output to the controlling terminal in addition to syslog.
DEBUGGING
The following environment variables are supported to help debugging. When used in conjunction with the "--no-daemon" option (thus echoing
PPP and DHCP helper output to stdout) these can quickly help pinpoint the source of connection issues.
NM_SERIAL_DEBUG
When set to anything, causes NetworkManager to log all serial communication to and from serial devices like mobile broadband 3G
modems.
NM_PPP_DEBUG
When set to anything, causes NetworkManager to turn on PPP debugging in pppd, which logs all PPP and PPTP frames and client/server
exchanges.
SEE ALSO
nm-tool(1)
NETWORKMANAGER(8)