Here is a simple Linux bash script for uploading images to WeatherUnderground. Backstory and steps at end of post.
if [ -r $MEDIAFILE ]
# File seems to exist and is readable
ftp -n $FTPHOST <<END_SCRIPT
quote USER $FTPUSER
quote PASS $FTPPASS
put $MEDIAFILE image.jpg
I use BlueIris for my weather camera management. BlueIris is great except that I am limited to one FTP upload per camera. Currently I upload from the BlueIris weather cam to this web site. The challenge I faced was trying to get the image over to WeatherUnderground to see images of the historical forecast.
By using the script above, I am now able to use BlueIris to upload to my web server and then upload from my web server to WeatherUnderground. This solves my single-server upload limitation in BlueIris.
- Log in to your Ubuntu/Linux server. If using a gui, launch terminal. I run as interactive root (sudo -i).
- Navigate to a script folder. For me this is “cd /usr/local/bin“.
- Run nano and your file name. “nano ftp.sh“.
- Change the variables in the script above and copy/paste into the nano text editor window.
- Note: if you are behind a router or having an issue with NAT (ftp bind error won’t bind to IP x.x.x.x only y.y.y.y), use command “ftp -niv -p” instead of “ftp -n” and test your connection.
- “ctrl +x” to save
- Run “chown non-sudo-user:non-sudo-user ftp.sh“. This changes ownership of the file to your non-sudo user account.
- Run “chmod +x ftp.sh“. This makes your script executable.
- Run “su username” to run as your camera01p user or other non-sudoer.
- Run “crontab -e” and insert the following:
- “ctrl +x” to save.
- Exit out if finished. Type “exit” and press enter.
You should now see your images upload ~every 60 seconds. I was monitoring my firewall logs and observed the connection being made. This confirmed that my script was running as a non-sudo user. I then switched over to WeatherUnderground and my images were being uploaded without problem.