Weblog entry #20 for Grimnar

That's it, I'm finished searching! [Bash help]
Posted by Grimnar on Sun 14 Jan 2007 at 23:10


Basic perl/bash help again.
I'm looking for a tiny script to rename one file, and that file is a webcam image that needs to be save every minute or so. That can be done in crontab.

So I'm really searching for the script to take /some/folder/webcam.jpg and make it /some/folder/webcam-TT-DD-YY.jpg

Found some old scripts wich are not working for me, I'm serious the worst bash/perl user ever!

The webcam image updates it self every 5 second. And after a couple of months I will make a time lapse video of my backyard. Pretty neat, eh?

And yeah, I've done a really extensive web search.

 

Comments on this Entry

Posted by yarikoptic (69.115.xx.xx) on Mon 15 Jan 2007 at 00:25
[ Send Message ]
well - if you call this a script here it is
mv /some/folder/webcam{,-`date +%F-%T`}.jpg

[ Parent | Reply to this comment ]

Posted by Anonymous (87.234.xx.xx) on Mon 15 Jan 2007 at 00:36
what about this one:


FILENAME=/foo/bar.jpg
DATE=$(date +%F_%H%M%S)
mv "$FILENAME" "${FILENAME%.jpg}-${DATE}.jpg"


This examples uses another naming scheme - you will surely need this increased time resolution, as the one you proposed above should not work for updates every minute :)
(additionally: it can be easily sorted by age)

[ Parent | Reply to this comment ]

Posted by Grimnar (85.221.xx.xx) on Mon 15 Jan 2007 at 01:38
[ Send Message | View Weblogs ]
worked like a charm! Thanks a lot. Now of course, I'm considering saving 2 pictures every minute. Can this be introduced to the script. Like"wait 30 sec run again?"

Thanks again!:)

[ Parent | Reply to this comment ]

Posted by Grimnar (85.221.xx.xx) on Mon 15 Jan 2007 at 02:09
[ Send Message | View Weblogs ]
Oh well. The computer that hosts the webcam just died on me. The power supply just fried. How very typical, just got a good working script. Something else fails. Damn. Smells very fishy too!

[ Parent | Reply to this comment ]

Posted by Anonymous (68.0.xx.xx) on Mon 15 Jan 2007 at 05:57
If you're running the web-cam off a linux host you might want to look at the 'motion' package.

It can do all sorts of interesting stuff with webcams (in addition to taking a simple snapshot every 'n' seconds). It will handle naming the snapshots itself and can even build a movie file on-the-fly.

[ Parent | Reply to this comment ]

Posted by Grimnar (85.221.xx.xx) on Mon 15 Jan 2007 at 11:21
[ Send Message | View Weblogs ]
I'm running the webcam from another operating system, based in Redmond. Due my other SO. And because I never got that Logitech cam to work at all in Debian.

[ Parent | Reply to this comment ]

Posted by Anonymous (84.45.xx.xx) on Mon 15 Jan 2007 at 20:44
Oh if you want a script then you won't want to know which webcam apps in Debian does this automatically, and can ftp them to a remote server as well. It will do the snap at regular intervals plus the naming and ftp.

It is gqcam or camorama I think -- my webcam is hiding downstairs or I'd say when, there are probably others.

Someone else may know for sure.

[ Parent | Reply to this comment ]

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search