[TriLUG] bash script, motion, scp

James Tuttle jjtuttle at trilug.org
Fri Jan 11 11:03:05 EST 2008


Hi,

I'm working on my motion configuration.  Motion allows an
on_picture_save option.  Many people use wput to ftp the picture to a
remote server, but I couldn't get that to work and I don't care for
plain text authentication.

I'd like to use scp.  In my motion.conf file I have this line:
on_picture_save /home/jjtuttle/.motion/onsave.sh %f
%f should expand to the to filename of the saved picture.

My onsave.sh file reads thusly:
#/bin/bash

scp $1 jim at bt:~/www/private/motion/.
echo "SCP'd $1 to bt"

However, the %f doesn't seem to be expanding.  I get this error:
[1] File of type 2 saved to:
/home/jim/Documents/personal/motion/01-20080111110000-snapshot.jpg
%f: No such file or directory
SCP'd %f to Braggtown

So, my question is, how can I use SCP to save this picture to a remote
location.  I suppose I could trigger a script that finds the most recent
 image in the directory and SCP's that, but during a motion capture
event pictures are saved pretty quickly and I wonder if I'd miss some.

Any ideas?

Thanks,
Jim
-- 
--
---Jim Tuttle
------------------------------------------------------
http://www.braggtown.com
PGP Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x69B69B08




More information about the TriLUG mailing list