LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-26-2013, 08:37 AM   #1
druisgod
Member
 
Registered: Jun 2004
Location: Maine
Distribution: LFS Mint OS, LFS, CENTos,
Posts: 119

Rep: Reputation: 18
VPN script


Hi!

I'm planning on running sabnzbd over vpn and I want to write a script to stop sab if I lose VPN and to start it again once VPN has been reestablished.

The issue I'm having is how to get a script to pull in my outside ip. Thoughts?
 
Old 06-26-2013, 08:43 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by druisgod View Post
Hi!
I'm planning on running sabnzbd over vpn and I want to write a script to stop sab if I lose VPN and to start it again once VPN has been reestablished.

The issue I'm having is how to get a script to pull in my outside ip. Thoughts?
Run ifconfig on your interface, and pull it into a variable.
 
Old 06-26-2013, 09:13 AM   #3
druisgod
Member
 
Registered: Jun 2004
Location: Maine
Distribution: LFS Mint OS, LFS, CENTos,
Posts: 119

Original Poster
Rep: Reputation: 18
Quote:
Originally Posted by TB0ne View Post
Run ifconfig on your interface, and pull it into a variable.
I nat, so that would only get me the internal ip. I found it with google. Thanks though!

#!/bin/bash
wget http://checkip.dyndns.com/ 2>1 /dev/null
cat index.html | awk '{print $6}'|cut -d"<" -f1
 
Old 06-26-2013, 09:42 AM   #4
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
A much simpler approach is this:
Code:
wget -qO- http://icanhazip.com
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
automate script for VPN keys qwertyjjj Linux - Newbie 14 01-10-2010 12:05 PM
vpn connect/disconnect shell script rashmeepawar Programming 11 10-05-2009 08:15 AM
Bash script for VPN login oopicwow Programming 6 01-21-2008 08:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration