publish (617B)
1 #!/bin/sh 2 [ -d ./public ] || { printf "No public/ folder present in current directory\n" && exit 1; } 3 destdir=/var/www/"$(basename "$(pwd)")" 4 5 ping -c 1 vps >/dev/null 2>&1 || { printf "Host 'vps' not reachable.\n" && exit 1; } 6 printf "Upload public/ to vps:%s? [Y/n] " "$destdir" 7 read -r conf 8 case "$conf" in 9 Y|y|Yes|yes) 10 ;; 11 *) 12 echo "User cancelled." 13 exit 0 14 ;; 15 esac 16 17 # Use long names for clarity 18 rsync \ 19 --partial \ 20 --update \ 21 --recursive \ 22 --copy-links \ 23 --compress \ 24 --prune-empty-dirs \ 25 --delete-after \ 26 --verbose \ 27 --human-readable \ 28 --progress \ 29 public/ vps:"$destdir"