deployfile.sh: be smarter about file ownership etc when deploying with rsync
authorJeff Davis <jdavis@sitka.bclibraries.ca>
Fri, 25 Sep 2015 19:51:38 +0000 (12:51 -0700)
committerJeff Davis <jdavis@sitka.bclibraries.ca>
Fri, 25 Sep 2015 19:51:38 +0000 (12:51 -0700)
deployment/deployfile.sh

index c430750..b76dd9b 100755 (executable)
@@ -80,8 +80,10 @@ fi
 if [[ -z "$USER" ]]
 then
   SSH="ssh"
+  RSYNC_OPTS="-avz"
 else
   SSH="ssh -l${USER}"
+  RSYNC_OPTS="-rlpD --chown=${USER}:${USER}"
 fi
 
 if [[ -z "$PROD" ]]
@@ -98,5 +100,5 @@ do
   if [[ -z "$VERBOSE" ]]; then
     echo -e "$HOST:\n\tFILE=$FILE\n\tDEST=$DEST\n\tUSER=$USER\n\tBACKUP=$BACKUP\n\tSSH=$SSH\n\tRSYNC_DEST=$RSYNC_DEST\n\tAUTOPATH=$AUTOPATH\n\tAUTODEST=$AUTODEST\n"
   fi
-  rsync -e"${SSH}" $BACKUP -avz $FILE $RSYNC_DEST
+  rsync -e"${SSH}" $BACKUP $RSYNC_OPTS $FILE $RSYNC_DEST
 done