#!/bin/bash echo "Content-type: text/html" echo "" echo 'Bell Rang!!!' echo "" echo "" img="$(date +%s)"; #get time/date stamp for images let h="$(date +%H)"; #get current hour #Create log file echo "====================" >> /tmp/doorbell.log date >> /tmp/doorbell.log echo "Hour: $h" >> /tmp/doorbell.log #if it's between 8AM and 8PM ring bell if [[ "$h" -ge 8 ]] && [[ "$h" -lt 22 ]] then echo "Rang..." >> /tmp/doorbell.log wget -q "" -O /dev/null & mplayer bell.mp3 > /dev/null & wget -q "" -O /dev/null & #set ip video 9100a to correct camera wget --user= --password= "http:///SetChannel.cgi?Channel=2" -O /dev/null fi #take 4 photos and upload them for i in `seq 1 4` do wget --user= --password= "http:///Jpeg/CamImg.jpg" -O "../imgs/${img}_${i}.jpg" && curl -X POST -F "file=@../imgs/${img}_${i}.jpg" "https:///upload.php" -o /dev/null sleep 1 done