« some more MythTV improvementskitchen webcam »

kitchen webcam part 2

2007/07/23

  06:06:46 am, by   , 507 words  
Categories: Gentoo Linux, Hardware, LAN Websites

kitchen webcam part 2

Second part - have kitchen webcam send regular pictures

Found this great blog with instructions ... looks like since I want to use SSH (scp really) to copy the images around, that I'll have to set up SSH passkeys for the webcam user.

http://girasoli.org/?p=66

So, emerge the xawtv package (which has the 'webcam' application in it).

# emerge -av xawtv

then modify the config file:

# nano /root/.webcamrc

the contents look something like this when I was done:

[ftp]
host = torbensorensen.com
user = xxxx
#pass = xxxx
dir  = /home/webcam_user/webcampics/firewall
file = webcam.jpeg
tmp  = uploading.jpeg
passive = 0
debug = 1
auto = 0
local = 0
ssh = 1

[ftp2]
host = security.torbolan.com
user = xxxx
#pass = xxxx
dir  = /home/webcam_user/webcampics/firewall
file = webcam.jpeg
tmp  = uploading.jpeg
passive = 0
debug = 1
auto = 0
local = 0
ssh = 1

[grab]
device = /dev/v4l/video0
text = "kitchen webcam %Y-%m-%d %H:%M:%S"
#infofile = filename
width = 400
height = 300
delay = 10
wait = 0
#input =
#norm =
rotate = 0
top = 0
left = 0
bottom = -1
right = -1
quality = 50
trigger = 30
once = 1

Also, created a new user to handle this (on all 3 boxes involved).

On the box with the webcam, make sure this new user is in the video group in /etc/group.

There are two ftp sections because I want these images to go to two different servers.

Details on this .webcamrc can be found at:

# less /usr/share/doc/xawtv-3.95-r1/webcamrc.bz2

this program can be tested by using this command:

# webcam /root/.webcamrc

Next we need to create a script and set up a cron job to regularly run this 'webcam' process. This needs to be done as the 'webcam' script cannot seem to do what is says it can do and keep a continuous connection to the webcam. So, we set the 'once' parameter, and keep rerunning the script every minute or so.

Copy the .webcamrc file into the new webcam user, change into that webcam user and create this script:

# nano webcamscript.sh

#!/bin/bash
/usr/bin/webcam /home/webcam_user/.webcamrc > /dev/null 2>&1

Make this new script executable:

# chmod +x webcamscript.sh

Make a crontab entry to run this script on a set schedule:

# crontab -e

Huh - I had an issue with this and not even adding this user to /etc/cron.allow allowed this edit command to work - so switch to root and run this:

# crontab -u webcam_user -e

and add this into the editor:

*/15 * * * * /home/webcam_user/webcamscript.sh

alrighty - now we've got webcam images being copied regularly to the two servers - now final part - on those two servers these files need to be copied into the webserver htdocs directories so they can be viewed.

So, on the security box, as the webcam user, create this script and set up in crontab as above.

# nano copywebcamfiles.sh

#!/bin/bash
cp /home/webcam_user/webcampics/firewall/webcam.jpeg /var/www/websecurity/htdocs/webcam.jpeg [gt] /dev/null 2[gt][amp]amp;1

Be sure the resulting file has the right premissions for this copy operation - test the script as the webcam_user.

No feedback yet


Form is loading...

April 2024
Mon Tue Wed Thu Fri Sat Sun
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          
 << <   > >>
LAN / Networks related items ...

Search

  XML Feeds

blog software