#!/bin/bash # # ULoadCam camera script. # # THIS IS FREE just drop me an e-mail if you end up using it. # # Yazz D. Atlas 1998 # # uploadcam@230volts.net # source /etc/profile # # requires a SGI with a camera and installation of dmedia_eoe.sw.tools, # ssh, and ImageMagick. # # Since the SGI has a nice way of checking for items to run I used it. # You'll need to creat a file called webcam in /etc/config/ # You'll need to have root permission to do this. # if /sbin/chkconfig webcam; then echo "Camera ENABLED" camera="ENABLED" else echo "Camera DISABLED" camera="DISABLED" fi # # send snapshot # # Image to send when the camera is turned off.. # OFFTHEAIR="/var/tmp/off.jpg" # temp dir cd /var/tmp while [ $camera != "FOO" ] ; do if [ $camera = "ENABLED" ] ; then sleep 10 /bin/echo "Starting At The Top" DATE=$(/bin/date +'%m/%d/%y'); DATE2=$(/bin/date +'%H:%M:%S'); rm -f out*.rgb >/dev/null 2>&1 touch webcamera_off /bin/echo "Snaping" /usr/sbin/vidtomem -z 1/2 -v 1 > /dev/null 2>&1 if [ -r out-00000.rgb ] ; then rm -f sgisnap$$.jpg >/dev/null 2>&1 /bin/echo "Converting ON" /usr/local/bin/convert -quality 65 -pen black -font -*-*-*-*-*-*-7-*-*-*-*-*-*-* \ -box yellow -draw 'text 120,220 "On '$DATE' '$DATE2'"' out-00000.rgb sgicomp.jpg fi if /sbin/chkconfig webcam; then camera="ENABLED" else camera="DISABLED" fi else if [ -f webcamera_off ] ; then /bin/echo "Hey Its off!" DATE=$(/bin/date +'%m/%d/%y'); DATE2=$(/bin/date +'%H:%M:%S'); /bin/echo "Converting Off" /usr/local/bin/convert -sample 320 -quality 100 -pen black -font -*-*-*-*-*-*-7-*-*-*-*-*-*-* \ -box yellow -draw 'text 120,220 "Off '$DATE' '$DATE2'"' $OFFTHEAIR camera-off.jpg /bin/echo "Sending Off" # Ok this is how I get the image to my server. I guess you could use ftp but # I don't like send out my password in the clear. # You have to setup ssh to trust your machine. /usr/local/bin/scp -q camera-off.jpg username@webserver.something.com:htdocs-230Volts/links/not_telling_you.jpg /bin/echo "Exit" fi rm -f webcamera_off* exit fi if [ $camera = "ENABLED" ] ; then /bin/echo "Sending On" # Ok this is how I get the image to my server. I guess you could use ftp but # I don't like send out my password in the clear. # You have to setup ssh to trust your machine. /usr/local/bin/scp -q sgicomp.jpg username@webserver.something.com:htdocs-230Volts/links/not_telling_you.jpg rm -f sgicomp* >/dev/null 2>&1 fi /bin/echo "Starting over" done