Created
January 31, 2011 17:18
-
-
Save figital/804400 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script runs every minute using crontab. It logs into your router | |
# and grabs a DHCP that will be scraped later with PHP. | |
HOST='192.168.1.1' | |
FEEDDIR='/home/sfitchet/git-repos/roto' | |
COOKIES=$FEEDDIR'/cookies.txt' | |
USER='admin' | |
PASS='alpine' # j/k ;) | |
FILENAME='/DHCP_Static.asp' # This is URI we want from our router's admin page | |
# Get the DHCP HTML page and save it to a temporary location | |
wget -E -O $FEEDDIR$FILENAME'.html.temp' --cookies=on --keep-session-cookies --save-cookies=$COOKIES $HOST$FILENAME --http-user $USER --http-password $PASS | |
# When the download is complete, copy the file to the production path and then | |
# delete the temp file. | |
cp $FEEDDIR$FILENAME'.html.temp' $FEEDDIR$FILENAME'.html' | |
rm $FEEDDIR$FILENAME'.html.temp' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment