Last active
July 18, 2019 22:43
-
-
Save daliborgogic/990cc5b556ccb69859797f633b1593f0 to your computer and use it in GitHub Desktop.
Syncs directories and S3 prefixes. Recursively copies new and updated files from the source directory to the destination.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*/10 * * * * /home/dlbr/documents/scripts/s3sync.sh >> /home/dlbr/documents/logs/s3sync.log 2>&1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/usr/local/bin/aws s3 sync | |
| /home/dlbr/ | |
| s3://dlbr/ | |
# Displays the operations that would be performed using the specified | |
# command without actually running them. | |
# | --dryrun | |
| --endpoint "https://sfo3.digitaloceanspaces.com" | |
# (string) Exclude all files or objects from the command that matches | |
# the specified pattern. | |
| --exclude "*" | |
# (string) Don't exclude files or objects in the command that match | |
# the specified pattern. | |
| --include "apps/*" | |
| --include "backups/*" | |
| --include "desktop/*" | |
| --include "documents/*" | |
| --include "music/*" | |
| --include "pictures/*" | |
| --include "templates/*" | |
| --include "videos/*" | |
# (boolean) When syncing from S3 to local, same-sized items will be ignored only | |
# when the timestamps match exactly. The default behavior is to ignore | |
# same-sized items unless the local version is newer than the S3 version. | |
# | --exact-timestamps | |
# (boolean) Makes the size of each key the only criteria used to decide whether | |
# to sync from source to destination. | |
# | --size-only | |
# (boolean) Delete files that exist in the destination but not in the source are deleted | |
# during sync. | |
| --delete |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XDG_DOWNLOAD_DIR="$HOME/downloads" | |
XDG_TEMPLATES_DIR="$HOME/templates" | |
XDG_PUBLICSHARE_DIR="$HOME/public" | |
XDG_DOCUMENTS_DIR="$HOME/documents" | |
XDG_MUSIC_DIR="$HOME/music" | |
XDG_PICTURES_DIR="$HOME/pictures" | |
XDG_VIDEOS_DIR="$HOME/videos" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
# Make the script executable $ chmod -x s3sync.sh