Bash scripts, use at your own risk etc..
picam_ip_email.sh
sends healthcheck type prints to email
#!/bin/bash
# script to email logfiles to toby
# then delete the logfiles to save space
#ifconfig eth0 > picam_ip.log
#df -v >> picam_ip.log
# get the single digit of time, ie 0-9 for file extension
day=`date "+%a"`
DMY=`date "+%x"`
now=`date "+%R"`
taken=$day"_"$DMY"_"$now
gettime=`date "+%M"`
#insert healthcheck commands here
{
ifconfig eth0
df -v
echo "#################### usb devices ##################"
lsusb
ls /dev/vid*
echo " "
ls -lrt
} | mutt -s "Picam ip address "$taken -- toby@home.co.uk
#rm -f /home/pi/picam_ip.log
picam1.sh
takes a picture from webcam, and names it based on the minute, minutes 0-9...
then uploads it to ftp server
#!/bin/bash
# script to take picture from webcam on /dev/video0
# then upload to gliding centre webserver
# get the single digit of time, ie 0-9 for file extension
day=`date "+%a"`
DMY=`date "+%x"`
now=`date "+%R"`
taken=$day"_"$DMY"_"$now
gettime=`date "+%M"`
lastminute=`echo $gettime | sed -e 's/\(^.*\)\(.$\)/\2/' `
filename="picam01_"$lastminute".jpg"
# take photo
fswebcam -d /dev/video0 -i 0 --title "HusBos West" -r 640x480 $filename
echo picture taken $taken
# upload to website
ncftpput -u username -p password your.ftpserver.co.uk /picam/1/ $filename
echo picture $filename uploaded $taken
picam1_email-1.sh
emails the logfile generated from the webcams
#!/bin/bash
# script to email logfiles to toby
# then delete the logfiles to save space
# get the single digit of time, ie 0-9 for file extension
day=`date "+%a"`
DMY=`date "+%x"`
now=`date "+%R"`
taken=$day"_"$DMY"_"$now
gettime=`date "+%M"`
#echo "Picam1 logfiles "$taken | mutt -a "/home/pi/picam1.log" -s "picam1 logfiles "$taken -- toby@home.co.uk
{
cat /home/pi/picam1.log
} | mutt -a "/home/pi/picam1.log" -s "picam1 logfiles "$taken -- toby@home.co.uk
rm -f /home/pi/picam1.log
No comments:
Post a Comment