Skip to content

Instantly share code, notes, and snippets.

@dgacitua
Created August 20, 2022 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgacitua/ebb93ebb9613113cfcc5e0eb3a705606 to your computer and use it in GitHub Desktop.
Save dgacitua/ebb93ebb9613113cfcc5e0eb3a705606 to your computer and use it in GitHub Desktop.
Bash script to backup remote server's home directory to local folder
#!/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