Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'production/miscToolsAndNotes/syncWebFiles/pushDLSite.sh')
-rwxr-xr-xproduction/miscToolsAndNotes/syncWebFiles/pushDLSite.sh86
1 files changed, 86 insertions, 0 deletions
diff --git a/production/miscToolsAndNotes/syncWebFiles/pushDLSite.sh b/production/miscToolsAndNotes/syncWebFiles/pushDLSite.sh
new file mode 100755
index 000000000..b8b936df9
--- /dev/null
+++ b/production/miscToolsAndNotes/syncWebFiles/pushDLSite.sh
@@ -0,0 +1,86 @@
+#!/usr/bin/env bash
+
+function usage ()
+{
+ printf "\n\t%s\n" "This utlity is to push web files (but not drop artifacts) up host machine, after local testing and development."
+ printf "\t%s\n" "Care is needed since it can delete files on host, for the goal of making contents equal."
+ printf "\t%s\n" "Thus, at least one parameter is needed: -f or -s; for 'full' or 'synchronize'"
+ printf "\t%s\n" "-f (full) should be rarely needed; only when just getting started, or similar."
+ printf "\t\t%s\t%s\n" "-f" "Does a full copy from remote host to local client".
+ printf "\t\t%s\t%s\n" "-s" "Copies files from remote host to local client, but also deletes files on client, that are not on host."
+ printf "\t\t%s\t%s\n" "-r" "All operations are 'dry-runs' unless '-r' ('run') is specified."
+ printf "\t\t%s\t%s\n" "-v" "verbose output."
+ printf "\t\t%s\t%s\n" "-h" "Displays this 'usage' information."
+
+}
+
+doit="--dry-run"
+verbose=""
+delete=""
+trailing=""
+full=""
+sync=""
+while getopts 'fsrvh' OPTION
+do
+ case $OPTION in
+ h) usage
+ exit 1
+ ;;
+ f) delete=""
+ full="true"
+ ;;
+ s) delete="--delete"
+ sync="true"
+ ;;
+ v) verbose="--verbose"
+ ;;
+ r) doit=""
+ ;;
+ # ?) usage
+ # exit 2
+ # ;;
+ esac
+done
+
+# We do not currently use trailing arguments,
+# but for safety/sanity checks, issue "error" if found.
+shift $(($OPTIND - 1))
+trailing="$@"
+
+if [[ -n "${trailing}" ]]
+then
+ printf "\n\tERROR: \t%s\n" "Unexpected trailing arguments were found, so exiting."
+ usage
+ exit 1
+fi
+
+# if BOTH f and s specified, it is an error.
+# if NEITHER f nor s is specified, it is a "no op", but we can treat as a "--dry-run" of full copy?
+
+if [[ "${full}" == "true" && "${sync}" == "true" ]]
+then
+ printf "\n\tERROR: \t%s\n" "Both full and sync were specified."
+ usage
+ exit 1
+fi
+
+if [[ -z "${full}" && -z "${sync}" && -z "${doit}" ]]
+then
+ printf "\n\tERROR: \t%s\n" "Neither full nor sync were specified, but 'run' was."
+ usage
+ exit 1
+fi
+
+# we exclude 'index.html' since that is a "derived" file, and is specific to what is in "drop directories".
+# we excldue the drop directories since they can be massive, and do not need them to do web development.
+# repeating --itemize-changes is intentional, and causes unchanged files to also be listed.
+rsync ${doit} ${verbose} ${delete} --itemize-changes --itemize-changes -P -e ssh -a --exclude /index.html --exclude /drops4/ ./downloads/ build:~/downloads/eclipse/downloads/
+
+if [[ -z $full && -z $sync ]]
+then
+ printf "\n\tWARNING: \t%s\n" "Neither full nor sync were specified, so symply did full (dry-run) list of what would be copied."
+ usage
+ exit 0
+fi
+
+

Back to the top