Created
August 20, 2022 20:15
-
-
Save dgacitua/ebb93ebb9613113cfcc5e0eb3a705606 to your computer and use it in GitHub Desktop.
Bash script to backup remote server's home directory to local folder
This file contains 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 | |
# https://gist.github.com/spyesx/0edd62936600ffe7ca0b5c27bc7d080c | |
# https://explainshell.com/explain?cmd=rsync+-azuvhP+--delete+--exclude%3D%22node_modules%22 | |
set -e | |
# Replace SOURCE and DESTINATION values to match your needs | |
SOURCE="remoteuser@mydomain.info:/home/remoteuser/" | |
DESTINATION="/home/localuser/rsync-backup" | |
mkdir -p $DESTINATION | |
rsync -azuvhP --delete --exclude="node_modules" $SOURCE $DESTINATION | |
set +e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment