Page 1 of 1

Bash scrip

Posted: Tue Jul 10, 2018 11:26 pm
by dazza1223
Hi has any one made bash scrip to take snapshot off a ip cam and over lay in with data?

Re: Bash scrip

Posted: Tue Jul 10, 2018 11:56 pm
by Toxic17
yep :)

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>.


then minute script

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


Image

Re: Bash scrip

Posted: Wed Jul 11, 2018 9:14 am
by dazza1223
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 :D