Sample Upload Script
The following shell script will upload the contents of the current directory to your polymaths.page account.
- This script assumes your username on the server is the same as the username you’re currently locked in with on your own computer; to specify the username it, use
username@polymaths.pageinstead ofpolymaths.pagein the last line. - You can specify the domain name as the first argument (the default is the name of the current directory)
- You can specify the directory to upload the contents of as the second argument (the default is
_siteorpublicif those directories exist, which helps with some SSGs, or the current directory’s contents if they do not)
Feel free to modify this script as you see fit, of course, or ask if you have trouble.
#!/bin/sh
if [ -n "$1" ]; then
domain="$1"
else
domain=`basename "$PWD"`
fi
if [ -n "$2" ]; then
build_folder="$1"
else
if [ -d _site ]; then
build_folder="_site/"
elif [ -d public ]; then
build_folder="public/"
else
build_folder="$(realpath .)/"
fi
fi
rsync --delete-during --zc=zstd --update --progress --itemize-changes --stats -r "$build_folder" "polymaths.page:~/html/$domain/"