Welcome to the Cumulus Support forum.
Latest Cumulus release v1.9.4 (build 1099) - 28 November 2014
Latest Cumulus MX release v3.0.0 build 3047 - 03 February 2019. See the Wiki for download
Latest Cumulus release v1.9.4 (build 1099) - 28 November 2014
Latest Cumulus MX release v3.0.0 build 3047 - 03 February 2019. See the Wiki for download
Bash scrip
- dazza1223
- Posts: 496
- Joined: Sun 25 Jan 2015 8:41 pm
- Weather Station: Davis Vantage Vue
- Operating System: raspberry pi 3 +
- Location: worthing
- Contact:
Bash scrip
Hi has any one made bash scrip to take snapshot off a ip cam and over lay in with data?
have fun and keep learning
dazza
dazza

- ConligWX
- Posts: 748
- Joined: Mon 19 May 2014 10:45 pm
- Weather Station: Davis VPro2 Plus +DFARS
- Operating System: MeteoBridge Nano SD
- Location: Bangor, NI
- Contact:
Re: Bash scrip
yep 
I run mine every minute I think with crontab. something like this:
camdataT.txt Template processed realtime.
then minute script


I run mine every minute I think with crontab. something like this:
camdataT.txt Template processed realtime.
Code: Select all
Temp: <#temp>°C - Press: <#press> hPa - Hum: <#hum>% - Wind: <#wspeed> mph(<#currentwdir>) - Rain: <#rfall> mm - UV Index: <#UV> - SolarRad: <#SolarRad> W/m² - CloudBase: <#cloudbase>.
Code: Select all
#!/bin/sh
#
#set variable yday to be like 20100208
#
#tday=$(date -d today +%Y%m%d%H%M%S);
#stamp=$(date '+DATE: %d/%m/%y%nTIME:%H:%M:%S');
tday=$(date +%Y%m%d%H%M%S);
#stamp=$(date +%Y%m%d);
#
# get weather image
wget --auth-no-challenge --http-user=xxxxxx --http-password=xxxxxxxx "http://xxx.xxx.xx.xxx/cgi/jpg/image.cgi" -O "/share/weather/sky1.jpg";
# next 2 lines add weather info
testdata="$(/bin/cat /share/weather/camdata.txt)";
testdata1=`date +"%A %d-%b-%Y %R %Z"`;
# add layers and text to image
convert -fill RoyalBlue4 -draw "fill-opacity 0.4 rectangle 0 0 1280 25" \
-fill red -draw "fill-opacity 0.6 rectangle 0 26 1280 27" \
-fill RoyalBlue4 -draw "fill-opacity 0.7 rectangle 0 695 1280 720" \
-fill red -draw "fill-opacity 0.6 rectangle 0 693 1280 694" \
-fill white -pointsize 18 -font /share/script/arialbold.ttf -draw "text 10,20 'Conlig Weather Station: $testdata1 - ICODOWNN2 - www.conligwx.org'" \
-fill yellow -pointsize 18 -draw "text 10,715 '$testdata'" /share/weather/sky1.jpg /share/weather/skywebcam.jpg
# convert image.jpg to 150kb for WUnderground
convert /share/weather/skywebcam.jpg -define jpeg:extent=150kb /share/weather/image.jpg
# ftp webcam to wunderground
lftp -e 'put /share/weather/image.jpg; bye' -u xxxxxxxx,passwordxxxx webcam.wunderground.com -d

Regards Simon
https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus - Meteobrige Nano SD + Saratoga Templates
https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus - Meteobrige Nano SD + Saratoga Templates
- dazza1223
- Posts: 496
- Joined: Sun 25 Jan 2015 8:41 pm
- Weather Station: Davis Vantage Vue
- Operating System: raspberry pi 3 +
- Location: worthing
- Contact:
Re: Bash scrip
o Simon thank you for that!!! i did have a Bash scrip but it keep crashing and makeing the imges go all funny? i will try and add yours..... but i will pont out this tho i do think it very nice that some ppl on here do share there hard work and give it to other and includeing you 

have fun and keep learning
dazza
dazza

-
- Posts: 72
- Joined: Tue 10 Sep 2013 8:40 pm
- Weather Station: Maplin N96FY
- Operating System: Windows 8
- Location: Freiston, Lincolnshire, UK
Re: Bash scrip
Thanks for this post Simon. Inspired with the idea I did the same for my webcams. All generated on a PI (which also runs my CumuusMX) and managed to integrate a background image using Imagemagick so it blends in with the rest of my website.
http://midlifedad.me.uk/weather/webcam_north.php
Andy
http://midlifedad.me.uk/weather/webcam_north.php
Andy
-
- Posts: 1505
- Joined: Sat 13 Aug 2011 9:33 am
- Weather Station: WH1081
- Operating System: Windows 7 64bit HP SP1
- Location: Somewhere in the USA
- Contact:
Re: Bash scrip
Very nice, love the time lapse. Is all that running on the Pi?
Assume the template is home built?
Assume the template is home built?
- ConligWX
- Posts: 748
- Joined: Mon 19 May 2014 10:45 pm
- Weather Station: Davis VPro2 Plus +DFARS
- Operating System: MeteoBridge Nano SD
- Location: Bangor, NI
- Contact:
Re: Bash scrip
I do have a tinelapse script too if you guys want it
I am in Berlin for a few days but back home hopefully on Wednesday evening.
I am in Berlin for a few days but back home hopefully on Wednesday evening.
Regards Simon
https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus - Meteobrige Nano SD + Saratoga Templates
https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus - Meteobrige Nano SD + Saratoga Templates
-
- Posts: 72
- Joined: Tue 10 Sep 2013 8:40 pm
- Weather Station: Maplin N96FY
- Operating System: Windows 8
- Location: Freiston, Lincolnshire, UK
Re: Bash scrip
The Timelapse runs on an old Windows PC using some external software (IPTimelapse) as the PI wasnt able to handle creating 3 video images. It snaps frames using rtsp from my cameras every 10 seconds and then compiles the videos just after midnight each day. Its scheduled to captue between dawn and dusk using lat / long plus I add a bias before and after dusk to capture dark to light and vice versa.
The template started life as a WeatherByYou template "Weather Blues 2" (there is a section in the Sandaysoft forum) but as I learnt more I added more. I cant take all the credit for it, most of that goes to Jacques who developed the original template.
Andy
The template started life as a WeatherByYou template "Weather Blues 2" (there is a section in the Sandaysoft forum) but as I learnt more I added more. I cant take all the credit for it, most of that goes to Jacques who developed the original template.
Andy
-
- Posts: 1505
- Joined: Sat 13 Aug 2011 9:33 am
- Weather Station: WH1081
- Operating System: Windows 7 64bit HP SP1
- Location: Somewhere in the USA
- Contact:
Re: Bash scrip
OK thanks wondered if the PI was capable of doing the time lapse as well as everything else!!
- dazza1223
- Posts: 496
- Joined: Sun 25 Jan 2015 8:41 pm
- Weather Station: Davis Vantage Vue
- Operating System: raspberry pi 3 +
- Location: worthing
- Contact:
Re: Bash scrip
i think it will be OK as i tried it with when i was running cumulus /SQL web server etc it a bit slow off making it but it dose the job and have u got the pi 3?
have fun and keep learning
dazza
dazza

- ConligWX
- Posts: 748
- Joined: Mon 19 May 2014 10:45 pm
- Weather Station: Davis VPro2 Plus +DFARS
- Operating System: MeteoBridge Nano SD
- Location: Bangor, NI
- Contact:
Re: Bash scrip
ok had a look at the script which did work but have done some editing due to the fact uploading to WU for webcams should be no more than 2 minutes apart. 1 minute intervals will most likely be ignored.
so with that I suggest one crontab entry for uploading to WU, there by a separate script or command line entry.
every 2 minutes.
then 2 other scripts,
one to handle the image layers and create image and timed filenames:
the other to create a timelapse video from the image history (run once a day) atapprox 00:01
Please note I have not run the timelapse one for sometime and may differ from you own setups but it should give you an idea of how to create a timelapse video from your images you create from the previous day. I dont take credit for this, most of which was give to me by a friend (ho66es), and I had tweaked it to my setup and values I wanted for my layers.
Also inclusive is my CamdataT.txt template processed by CumulusMX to camdata.txt
hope this helps someone.
so with that I suggest one crontab entry for uploading to WU, there by a separate script or command line entry.
every 2 minutes.
Code: Select all
# ftp webcam to wunderground
#
lftp -e 'put /share/htdocs/weather/image.jpg; bye' -u XXXXXXXX,xxxxxxxx webcam.wunderground.com
one to handle the image layers and create image and timed filenames:
Code: Select all
#!/bin/sh
#
# set variable yday to be like 20100208
#
# tday=$(date -d today +%Y%m%d%H%M%S);
# stamp=$(date '+DATE: %d/%m/%y%nTIME:%H:%M:%S');
tday=$(date +%Y%m%d%H%M%S);
# stamp=$(date +%Y%m%d);
#
# get weather image
wget --auth-no-challenge --http-user=xxxxx --http-password=xxxxxx "http://x.x.x.x/cgi/jpg/image.cgi" -O "/share/htdocs/weather/sky1.jpg";
# next 2 lines add weather info
#
testdata="$(/bin/cat /share/htdocs/weather/camdata.txt)";
testdata1=`date +"%A %d-%b-%Y %R %Z"`;
# convert -fill RoyalBlue4 -draw "fill-opacity 0.4 rectangle 0 0 1280 25" \
#
convert -fill RoyalBlue4 -draw "fill-opacity 0.4 rectangle 0 0 1280 25" \
-fill red -draw "fill-opacity 0.6 rectangle 0 26 1280 27" \
-fill RoyalBlue4 -draw "fill-opacity 0.7 rectangle 0 695 1280 720" \
-fill red -draw "fill-opacity 0.6 rectangle 0 693 1280 694" \
-fill white -pointsize 18 -font /share/db_backup/script/arialbold.ttf -draw "text 10,20 'Conlig Weather Station: $testdata1 - INEWTOWN20 - www.conligwx.org'" \
-fill yellow -pointsize 18 -draw "text 10,715 '$testdata'" /share/htdocs/weather/sky1.jpg /share/htdocs/weather/skywebcam.jpg
# convert image.jpg to 150kb for WUnderground
#
convert /share/htdocs/weather/skywebcam.jpg -define jpeg:extent=150kb /share/htdocs/weather/image.jpg
# add timestamp to filename for image history and video timelapse.
cp /share/htdocs/weather/sky.jpg /share/htdocs/weather/image-history/video@"$tday".jpg;
Code: Select all
#!/bin/sh
#maketimelapse movie
#
#set variable yday to be like 20100208
#
#yday=$(date +%Y%m%d %s -d $(( $(date +%s) - 86400 )));
yday=$(date -d "1 day ago" +%Y%m%d);
#
# make directory for yesterdays images
#
mkdir /share/htdocs/weather/image-history/"$yday";
# mkdir /volume1/Web/fishcam/image-history/"$yday";
#
# move yesterdays images to new directory sample image name is video@20100208000313.jpg
#
mv /share/htdocs/weather/image-history/video@"$yday"??????.jpg /share/htdocs/weather/image-history/"$yday"/;
# remove 0 byte files test script. find . -type f -size 0 | xargs ls -ld
cd /share/htdocs/weather/image-history/"$yday";
#find . -type f -size 0 | xargs rm;
# mv /volume1/Web/fishcam/image-history/video@"$yday"??????.jpg /volume1/Web/fishcam/image-history/"$yday"/;
# remove 0 byte files test script.
# cd /volume1/Web/fishcam/image-history/video@"$yday"??????.jpg /volume1/Web/fishcam/image-history/"$yday";
# /usr/bin/find . -type f -size 0 | xargs rm;
#
# create sequential files for ffmpeg to process apparently they have to be sequential for ffmpeg
#
x=1;
for i in $(ls -r -t /share/htdocs/weather/image-history/"$yday"/*jpg);
do counter=$(printf %04d $x);
ln -s "$i" /share/Public/tmp/img"$counter".jpg;
x=$(($x+1));
done;
#
#process with ffmpeg
#
# /volume1/.@plugins/AppCentral/upnp-server-v2/bin/ffmpeg -r 15 -f image2 -i /volume1/tmp/img%04d.jpg -qmax 9 /volume1/Web/weather/timelapse/"$yday".avi;
# /usr/local/bin/ffmpeg -r 15 -f image2 -i /volume1/tmp/img%04d.jpg -qmax 9 /volume1/Web/weather/timelapse/"$yday".avi;
ffmpeg -r 15 -f image2 -i /share/Public/tmp/img%04d.jpg -qmin 16 -qmax 26 /share/htdocs/weather/image-history/timelapse/"$yday".avi;
#
#tidy
#
rm /share/Public/tmp/img????.jpg;
#
# repeat final stages for fishcam..
#
# x=1;
# for i in $(ls -r -t /volume1/Web/fishcam/image-history/"$yday"/*jpg);
# do counter=$(printf %04d $x);
# ln "$i" /volume1/tmp/img"$counter".jpg;
# x=$(($x+1));
# done;
#
#process with ffmpeg
#
# /usr/local/bin/ffmpeg -r 15 -f image2 -i /volume1/tmp/img%04d.jpg -qmax 9 /volume1/Web/fishcam/timelapse/"$yday".avi;
# /volume1/Download/FFMPEG/ffmpeg -r 15 -f image2 -i /volume1/tmp/img%04d.jpg -qmax 9 /volume1/Web/fishcam/timelapse/"$yday".avi;
#
#tidy
#
# rm /volume1/tmp/img????.jpg;
#
#zip up yesterdays images to keep file count down
#
# /usr/builtin/bin/zip -rm0 /volume1/Web/fishcam/image-history/"$yday" /volume1/Web/fishcam/image-history/"$yday"
zip -rm9 /share/htdocs/weather/image-history/"$yday" /share/htdocs/weather/image-history/"$yday"
Also inclusive is my CamdataT.txt template processed by CumulusMX to camdata.txt
Code: Select all
Temp: <#temp>°C - Press: <#press> hPa - Hum: <#hum>% - Wind: <#wspeed> mph(<#currentwdir>) - Rain: <#rfall> mm - UV Index: <#UV> - SolarRad: <#SolarRad> W/m² - CloudBase: <#cloudbase>.
Regards Simon
https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus - Meteobrige Nano SD + Saratoga Templates
https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus - Meteobrige Nano SD + Saratoga Templates