Cron-based iSightcapture
 
Just some month ago I used to have here a nice bash script running hourly as a cron job taking picture from the iSight (the built-in web-cam) installed on my Mac. The script is still there but after one of the last upgrades from Apple something went wrong. I even started to collect a nice picture history with the idea of making a movie out of it one day (exactly as this guy). Maybe you want to see and use that script, here it is:
# iSight snapshots
tstamp=`date "+%m%d%y%H%M%S"`
isightcapture /Users/reborg/reborg.net/upload/iSightCaptures/$tstamp.jpg
echo "Captured snapshot $tstamp.jpg" >> /Users/reborg/reborg.net/upload/upload.log 2>&1
cd /Users/reborg/reborg.net/upload
convert -append iSightCaptures/$tstamp.jpg blank.ppm internmediate_file.ppm
echo "Executed conversion to intermediate file..." >> /Users/reborg/reborg.net/upload/upload.log 2>&1
convert internmediate_file.ppm -gravity "South" -draw "text 0,3 '`date "+%a %b %e %H:%M:%S"`'" cam.jpg
echo "Snaphot ready to upload..." >> /Users/reborg/reborg.net/upload/upload.log 2>&1
ftp -V -u ftp://yyy:xxx@reborg.net/pic/ cam.jpg >> /Users/reborg/reborg.net/upload/upload.log 2>&1
echo "Uploaded snapshot to web host..." >> /Users/reborg/reborg.net/upload/upload.log 2>&1mailto:az29gwZZ@reborg.netshapeimage_1_link_0
You need to install iSightCapture and the ImageMagick command line utilities which are used to convert the image in a suitable format and impress a timestamp on them. After that the image is uploaded to my web site and it’s visible here. This beautiful script works flawlessly stand-alone but fail now when scheduled by cron the usual way:
*/60 * * * * cd ~/cmd; ./upload2reborg
Where ~/cmd/upload2reborg is the executable file containing the script. I tried a couple of debugging sessions once without success. If anybody has a clue why the script is not working anymore from cron please write a comment to this post (yay, comment feature finally enabled on this blog, thanks iComment).
 
Reblog Details
Thursday, August 30, 2007

free hit counter