Right, got myself into a mess with this.
I was looking at that script (since I’ve decided I no longer need tars of everything and just having .sql backups of the databases and a mirror of my site is enough. However, if I rsync my home directory, I’ll get all sorts I do not need, such as
So, since I am going to use your method after all, AND I shall be dumping my databases (each have a different username so only 1 database and 1 username link together), I just would appreciate you checking the sample below. I’m trying to dump the database sql files into ‘Databases’ directory within my home/username/ directory on DH.
/usr/bin/ssh ME@MYDOMAIN.COM ‘/usr/bin/mysqldump --all-databases -hmysql.mydomain.com -uxxxxxx -pxxxxxxxx > /Databases/DB1.sql’
/usr/bin/ssh ME@MYDOMAIN.COM '/usr/bin/mysqldump --all-databases -hmysql.mydomain.com -uUSER2 -pPASS2 > /Databases/DB2.sql’
rsync -avze ssh ‘ME@MYDOMAIN.COM:/home/USERNAME/domain1.com’ '/Users/jayson/Backup’
rsync -avze ssh ‘ME@MYDOMAIN.COM:/home/USERNAME/Databases’ '/Users/jayson/Desktop/BackMeUpSafelySoon’
rsync -avze ssh ‘ME@MYDOMAIN.COM:/home/USERNAME/domain2.com’ '/Users/jayson/Backup’
rsync -avze ssh ‘ME@MYDOMAIN.COM:/home/USERNAME/domain3.com’ ‘/Users/jayson/Backup’
/usr/bin/ssh ME@MYDOMAIN.COM /bin/rm /Databases/*.sql
I’ve put xxxx where the username and passwords will go, leaving the leading -u and -p and the same for hostname, and since there’s only 1 database for each user (although maybe 3 databases under the same hostname) I can leave --all-databases since that will still keep each database in a separate .sql file.
The first two lines, since I will be running the above script on my Mac, I don’t need to give it directories? I mean, because when using SSH, the default directory is the home directory, the script dumps the .sql files into the home directory and that’s where there’s no directory paths set right?
Now, it seems I am SSH-ing for each command, is this right or can I change the script in some way that does all of the above and then that’s it done and dusted? As long as I get my files I don’t mind. I’m just concerned about my slashes etc… and making sure it all looks good to go. Where I’ve added directories of where to dump the database data etc…
I use Time Machine as you do too, so I now don’t need to datestamp my .sql files with Automator or anything (although I use FileVault so I can’t use the graphical fly motion finding of my files anymore).
Thanks for your help. If you could just kindly check that script, or anyone for that matter, I can then actually save it script.sh and run it each week.