View Single Post
Posts: 7 | Thanked: 4 times | Joined on Jan 2013
#13
This is a script I wrote to upload the images take from my N950 to a remote ftp folder. The idea was to schedule a cron task to upload any new pictures I've take every 10 minutes ONLY if I am home using the wireless. The script works great if I call it from the terminal manually. Unfortunately I couldn't setup the cron correctly, I keep on getting a permission error when the cron tries to run the script, it will be great if anyone can tell me how to overcome this permission issues.

Btw, you need to install lftp for this script to work

Cheers

Code:
#/bin/bash
FTPU="username"
FTPP="ftp password"
FTPS="remote ftp server"
FTPF="remote ftp server directory"
LOCALD="/home/user/MyDocs/DCIM"

LOGFILE="/tmp/backup.log"
if ifconfig | grep -q -e 192.168.1.200
then
  echo Started Pictures Backup at: `date` >> $LOGFILE
  /opt/lftp/bin/lftp -u $FTPU,$FTPP -e " set ftp:ssl-allow no;set ssl:verify-certificate no; mirror --only-newer --verbose --continue --reve$
  echo Pictures Update Finished at:  `date` >> $LOGFILE
else
  echo "Not at home, not synching anything: `date`" >> $LOGFILE
fi
 

The Following 2 Users Say Thank You to blackcoder For This Useful Post: