Donnerstag, 14. August 2014

linux shell script for endless photo capture with gphoto2 and automatic ftp-upload

linux shell script sourcecode:

#!/bin/bash
host='YOUR_HOSTNAME'
USER='YOUR_USERNAME'
PASS='YOUR_PASSWORD'
counter=1
while true
do
/usr/bin/gphoto2 --capture-image-and-download --filename
ftp -n -v $host <<EOT
ascii
user $USER $PASS
prompt
cd /YOUR_FOLDER_ON_FTP_SERVER_WHERE_PHOTOS_SHALL_PLACED/
put *.JPG
bye
EOT
cp *.JPG /var/www/YOUR_WEBSERVER_FOLDER_WHERE_A_COPY_SHALL_PLACED/last.JPG
rm *.JPG
echo waiting 20 sec
sleep 20
done

2 Kommentare:

  1. hi! thanks for this script, but I am having a problem with the ftp upload. The script tells me that it has no ftp. I am pretty sure that all my infos are right.

    AntwortenLöschen
    Antworten
    1. Hi jonbragi,
      Is there any ftp-client available on your machine?
      Try:
      sudo apt-get install ftp
      Andy

      Löschen