Created
February 8, 2014 15:22
-
-
Save openrijal/8885353 to your computer and use it in GitHub Desktop.
This bash script is to be run from local machine and it copies remote web files and database to local folder.
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
# Assumptions | |
######################### | |
# remote_host: example.com | |
# remote_user: johndoe | |
# db_user: mydbuser | |
# db_pass: mydbpass | |
# db_name: mydbname | |
# to dump mysql database in the remote system from local system | |
ssh [email protected] 'mysqldump -u mydbuser --password=mydbpass mydbname > /destination/path/dump_filename.sql' | |
# to sync remote folder with local folder (incremental sync) | |
rsync -ravz --progress -e "ssh -l johndoe" --delete example.com:/path/of/remote/folder/ /path/of/local/folder/ | |
# References | |
# 1. SSH Man Page:- http://unixhelp.ed.ac.uk/CGI/man-cgi?ssh+1 | |
# 2. RSYNC Man Page:- http://linux.die.net/man/1/rsync | |
# 3. Passwordless SSH Login: http://rcsg-gsir.imsb-dsgi.nrc-cnrc.gc.ca/documents/internet/node31.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment