forked from jaildesigner-jailgames/coffee_crisis
36 lines
949 B
Bash
Executable File
36 lines
949 B
Bash
Executable File
#!/bin/bash
|
|
readonly PROJECT=coffee_crisis
|
|
|
|
readonly USAGE="
|
|
USAGE:
|
|
$(basename "$0") [UPLOAD or DOWNLOAD]"
|
|
|
|
function help_message() {
|
|
echo "$USAGE"
|
|
}
|
|
|
|
PARAMETERS="UPLOAD DOWNLOAD upload download"
|
|
|
|
# check if there are all the parameters
|
|
if [ "$#" -ne 1 ]; then
|
|
help_message
|
|
exit 0
|
|
fi
|
|
|
|
# check if the systems parameter is valid
|
|
if ! echo "$PARAMETERS" | grep -w "$1" >/dev/null; then
|
|
help_message
|
|
exit 0
|
|
fi
|
|
|
|
# UPLOAD
|
|
if [ "$1" = upload ] || [ "$1" = UPLOAD ]; then
|
|
printf "\n%s\n" "uploading $PROJECT"
|
|
rsync -avzmPu --delete -e 'ssh -p 4545' . sergio@sustancia.synology.me:/home/sergio/backup/code/$PROJECT/
|
|
rsync -avzmPu -e 'ssh -p 4545' . sergio@sustancia.synology.me:/home/sergio/backup/code/$PROJECT.all/
|
|
fi
|
|
|
|
if [ "$1" = download ] || [ "$1" = DOWNLOAD ]; then
|
|
printf "%s\n" "downloading $PROJECT"
|
|
rsync -avzmP --delete -e 'ssh -p 4545' sergio@sustancia.synology.me:/home/sergio/backup/code/$PROJECT/* .
|
|
fi |