14 | | 2. Next you'll want to find out what your database password is. You'll do this by logging onto your site, navigating to the 'web/sites/default' folder, and downloading or reading the 'settings.php' file. That file will have a line with your database username and password in it in the following format: |
| 12 | * backups: contains daily database dumps. You should include this directory in your backup. |
| 13 | * bin: contains scripts to launch PHP for php-enabled web site, usually not modified by members. You should include this directory in your backup. |
| 14 | * cgi-bin: default location for perl, python and other web-site scripts, usually not used by members. You should include this directory in your backup. |
| 15 | * include: location for optional configuration files for your web site. You should include this directory in your backup. |
| 16 | * logs: access and error logs for your web site. You may optionally include this location in your backup. |
| 17 | * users: user email and personal data. You should not include this directory in your web backup since the user that can access your web data may not have persmission to read data in your user directory. |
| 18 | * web: contains all your web site files. You should include this directory in your backup. |
33 | | 7. The default settings in phpmyadmin will work for a basic backup. Navigate to the bottom of the page, CHECK the 'Save as file' button and choose 'gzipped' as your compression. Name the file something like 'mysite_020111.backup' (the numbers being a 6 digit date without punctuation). The program will add a '.sql' to the end of your file, and save it you your computer in the default download folder when you click save. |
34 | | |
35 | | If your browser times out during this operation or you experience other issues, please submit a support ticket to Mayfirst People link and us know. |
36 | | |
37 | | |
38 | | == COMMAND LINE == |
39 | | |
40 | | I created a very simple script to backup my files and database from the command line. |
41 | | |
42 | | {{{ |
43 | | #!/bin/bash |
44 | | mysqldump [database-name] > ~/[domain-directory]/web/[database-name]_`date +%y%m%d`.sql |
45 | | tar cvzf ~/backups/[site]_backup_`date +%y%m%d`.tgz ~/[domain-directory]/web |
46 | | rm -f ~/[domain-directory]/web/[database-name]_`date +%y%m%d`.sql |
47 | | }}} |
48 | | |
49 | | Copy and paste this text into a program like notepad, textedit or wordpad. Change the info inside the bracket [] for your own site. Save file as "backup.sh". SSH into your server and create a new directory called "backups". Put the script in that directory and make it executable (chmod 755 backup.sh). |
50 | | |
51 | | The first line (after #!/bin/bash) dumps a dated copy of your database right into your web directory (maybe not the best practice but it gets deleted very fast). |
52 | | The 2nd line creates in your "backups" directory a compressed tarball of everything in the "web" directory (including the database dump). |
53 | | The 3rd line deletes the database dump from the "web" directory. |
54 | | |
55 | | I would suggest first (after creating the "backups" directory) just running the 3 lines from your command line. The results should be a new dated *.tgz file in the "backups" directory. Also check that there is no *.sql file left in your "web" directory. If you have access errors doing the database dump, see here: [https://support.mayfirst.org/wiki/mysql_command_line_access]. If this works, try running the script: |
56 | | {{{ |
57 | | ./backups/backup.sh |
58 | | }}} |
59 | | After I run this I SFTP into the server and download the new backup to my local machine. I also keep the latest version on the server and delete the previous one. I do this periodically (every 2 weeks). I'm sure this could be easily improved but it works. I am looking at better options for automated back-up to cloud storage. |
| 32 | [http://www.techdrivein.com/2010/12/top-5-open-source-backup-software-for.html Several programs are available for Linux as well.] |