summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSJP/farm <st33v@f3rr3t.com>2018-01-06 14:32:23 +1100
committerSJP/farm <st33v@f3rr3t.com>2018-01-06 14:32:23 +1100
commitdd63d2deef86a75a2b33353287b65e3a0ba509b9 (patch)
tree4e81d8c6cb0ba3522ac7ca637fcf6456d6abee71
parentf280eeff40609a39b0b203633e9f1730d6638907 (diff)
generalise directories for farm
-rw-r--r--.gitignore1
-rwxr-xr-xrsync2eye.sh27
2 files changed, 19 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index c40ba3e..dd645af 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,3 +20,4 @@ nytprof.out
/_eumm/
/myob/
+local.config
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))