Skip to content

Instantly share code, notes, and snippets.

@christianascone
Created June 7, 2019 10:53
Show Gist options
  • Select an option

  • Save christianascone/115d131c5e1cf6d7b19a67b4aa50f16d to your computer and use it in GitHub Desktop.

Select an option

Save christianascone/115d131c5e1cf6d7b19a67b4aa50f16d to your computer and use it in GitHub Desktop.
Automatic rsync between local and remote machine using a no-password ssh key
#!/bin/bash
echo "###########################"
echo $(date -u) "Starting rsync data"
eval `ssh-agent -s`
ssh-add ~/.ssh/key_name
rsync -vrahe ssh ~/www/local/data/upload [email protected]:/home/remote/dir
echo $(date -u) "Ended rsync data"
echo "###########################"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment