sync (453B)
1 #!/usr/bin/env bash 2 3 readonly RSYNC_USER="${RSYNC_USER}" 4 readonly RSYNC_SERVER="${RSYNC_SERVER}" 5 6 main() { 7 local filepath="$1" 8 local name 9 name="$(basename "${filepath}")" 10 11 rsync --archive --verbose \ 12 "${HOME}/timelapse/${name}" \ 13 "${RSYNC_USER}@${RSYNC_SERVER}:/timelapse/${name}" 14 15 # Delete outdated files. 16 # This assumes the timelapse is created on an hourly basis. 17 rm -f "$1" 18 find "${HOME}/timelapse/" -mmin +60 -delete 19 } 20 21 main "$@"