summaryrefslogtreecommitdiff
path: root/rsync2eye.sh
diff options
context:
space:
mode:
Diffstat (limited to 'rsync2eye.sh')
-rwxr-xr-xrsync2eye.sh27
1 files changed, 18 insertions, 9 deletions
diff --git a/rsync2eye.sh b/rsync2eye.sh
index 80d136a..6385dd3 100755
--- a/rsync2eye.sh
+++ b/rsync2eye.sh
@@ -6,16 +6,27 @@
# Move files from Stan
# https://logbuffer.wordpress.com/2011/03/24/linux-copy-only-certain-filetypes-with-rsync-from-foldertree/
+# read local config from file. The following lines define the variables and
+# give examples for use. They will be overwritten by sourcing from local.config
+src=remoteSystem:/path/to/photos
+localpicdir=~/localpix
+walrusmountpoint=/mnt/walrus/eye
+# end of local.config vars
+
+if [ -e local.config ]; then
+ . local.config # source directory name from local config file
+else
+ echo "local.config does not exist"; exit 1
+fi
thisyear=$(date +%Y)
+localpicdir=${localpicdir}/${thisyear}
-src=st33v.ddns.net:/home/st33v/cams/
-dst=~/pix/ixus/${thisyear}/camz
if [ ! -d ${dst} ]; then
makedir -p ${dir}
fi
echo "$(date). Starting to move images from stan."
begin=$(date +"%s")
-rsync -a --remove-source-files --include='*/' --include='*.jpg' --exclude='*' -e "ssh -p 51337" $src $dst
+rsync -a --remove-source-files --include='*/' --include='*.jpg' --exclude='*' -e "ssh -p 51337" $src ${localpicdir}/stansCams
if [ $? -ne 0 ]; then
echo "rsync from stan failed with exit code $? - exiting"
@@ -27,10 +38,10 @@ difftimelps=$(($termin-$begin))
echo "$(($difftimelps / 60)) minutes and $(($difftimelps % 60)) seconds elapsed to copy from Stan."
# Is walrus mounted already?
-mountpoint -q /mnt/eye
+mountpoint -q ${walrusmountpoint}
if [ $? -eq 1 ]; then
- echo "Mounting walrus/pix to /mnt/eye."
- mount /mnt/eye
+ echo "Mounting walrus/pix to ${walrusmountpoint}."
+ mount ${walrusmountpoint}
fi
if [ $? -ne 0 ]; then
@@ -40,10 +51,8 @@ fi
echo "Starting at $(date). Backing up pix to walrus."
-
begin=$(date +"%s")
-rsync -a /mnt/dox/pix/* /mnt/eye
-#rsync -avn /mnt/dox/pix/* /mnt/eye
+rsync -a ${localpicdir}/* ${walrusmountpoint}
termin=$(date +"%s")
difftimelps=$(($termin-$begin))