Skip to content

Instantly share code, notes, and snippets.

@PHLAK
Created February 14, 2011 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PHLAK/826099 to your computer and use it in GitHub Desktop.
Save PHLAK/826099 to your computer and use it in GitHub Desktop.
Simple script for getting your external IP and uploading it to a server via SCP.
#!/bin/bash
# Define your server information here
SERVER="<hostname_or_ip>"
PORT="22"
USER="<user_name>"
FILEPATH="<file_path>"
# Get IP from whatismyip.com and store it in a file
wget http://www.whatismyip.com/automation/n09230945.asp -O ip.txt
# Copy ip.txt to your server
scp -P $PORT ip.txt $USER@$SERVER:$FILEPATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment