How I made my one tripod.com page redirect to the dynamic IP address of my webcam


I use the Apache webserver on my linux box with a program called camserv for my webcam page.
Before, I had no way to easily make a link to my webcam from my public webpage.
The problem was that I have a dynamic IP address that is assigned by my ISP.
Because of that, my webcam address would roam every day.
I use CAMSERV as my webcam software and it does well enough.
It lets you give people your IP address and the port number of your webcam.
I run "setup-webcam" after I am online to get things rolling.
That little script takes care of the everything I need done.


setup-webcam (ran as root):
#get the driver usbvideo driver for my webcam running
cd /home/user/usbvideo
modprobe videodev
insmod ibmdrv.o

#make the files that redirect
/root/camlinkmaker > /root/tmp/webcamlink.html
#/root/camlinkmaker2 > /root/tmp/webcamlink.pl

#send the files to the website via ftp
ftp -n ftp.site.com > ftp.result 2> ftp.result <user username password
binary
delete webcamlink.html
#delete webcamlink.pl
put /root/tmp/webcamlink.html webcamlink.html
#put /root/tmp/webcamlink.pl webcamlink.pl
bye
EOC

camlinkmaker:
MY_IP=`ifconfig ppp0 |grep 'inet addr'| awk '{print $2}'|sed -e "s/addr\://"`
echo "< HTML>"
echo "< HEAD>"
echo "< TITLE>Nathan Stenzel's Webcam redirect page</TITLE>"
echo "</HEAD>"

echo "< BODY onLoad='document.location.href="
echo '"http://'$MY_IP'/webcam.html";'
echo "'>"
echo "</BODY>"
echo "</HTML>"

camlinkmaker2 (not used because tripod is abusing my perl script):
!#/usr/bin/bash

MY_IP=`ifconfig ppp0 |grep 'inet addr'| awk '{print $2}'|sed -e "s/addr\://"`
echo "#! /usr/local/perl"
echo
echo "print 'Location: http://"$MY_IP"/webcam.html\n\n'"
Let me explain why I don't use that last file.
Tripod.com seems to not like the perl script that camlinkmaker2 makes.
If it would actually run, I would gladly use the resulting webcamlink.pl file.


Here is the webcamlink.pl file that camlinkmaker2 produces:
#! /usr/local/perl

print 'Location: http://IP of the day/webcam.html\n\n'

Here is the webcamlink.html that camlinkmaker produces:
< HTML>
< HEAD>
< TITLE>Nathan Stenzel's Webcam redirect page</TITLE>
< /HEAD>
< BODY onLoad='document.location.href="http://IP of the day/webcam.html";'>
< /BODY>
< /HTML>

There is only one thing wrong with this setup....
tripod.com inserts a banner into every single webpage you have....
so the visitors will have to wait for the banner ad to load before they get redirected to my webcam.
Home