How to PUSH pics to FTP Server

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
slahm
Posts: 6
Joined: Sun Jan 13, 2008 6:30 pm

How to PUSH pics to FTP Server

Post by slahm »

:D :D :D
This is after much trial and error(mostly because I am guessing most of the time), and cleans up the camera names, setting the uploaded filename to whatever you want. This is scripted for 4 cameras (2, 4, 5, 6) but you can take out or add whatever you need. It also assumes that you want passive mode. That should not hurt anything.

I received no real suggestions as to how to put my pictures once a minute onto a web server, via FTP, and I suck at scripting, but here is what I came up with. Seems to work. I added a cron job to do this once a minute. This has nothing to do with the camera settings for motion, events, etc. this simply takes a picture(with zmu), and uploads it, all in one script.

Code: Select all

#!/bin/sh
HOST='ftp.domain.com'
USER='username'
PASSWD='secret'
SRCPIC1='UGLYCAMNAME1.jpg'
SRCPIC2='UGLYCAMNAME2.jpg'
SRCPIC3='UGLYCAMNAME3.jpg'
SRCPIC4='UGLYCAMNAME4.jpg'
PIC1='newpicturename1.jpg'
PIC2='newpicturename2.jpg'
PIC3='newpicturename3.jpg'
PIC4='newpicturename4.jpg'
zmu -m2 -i -U admin -P <password>
zmu -m4 -i -U admin -P <password>
zmu -m5 -i -U admin -P <password>
zmu -m6 -i -U admin -P <password>
mv $SRCPIC1 $PIC1
mv $SRCPIC2 $PIC2
mv $SRCPIC3 $PIC3
mv $SRCPIC4 $PIC4
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
passive
cd if/youwant/tochange/dirs/
put $PIC1
put $PIC2
put $PIC3
put $PIC4
quit
END_SCRIPT
exit 0
Good Luck!
Post Reply