By Pushkar Gaikwad on
Is there any module which can take complete back of my full drupal site on daily basis ? Will really help me as my host only take backup on weekly basis.
Is there any module which can take complete back of my full drupal site on daily basis ? Will really help me as my host only take backup on weekly basis.
Comments
shell script
Are you on a linux host with access to cron?
If so, the easiest thing (what I do) is to invoke daily a shell script.
I have this script in /sites (e.g. /sites/bachup.sh). I created a folder /sites/backup, and every day the backup is saved there. Note, that every day this erases the previous day's backup. With a little work, you could make it leave a week's work of backups, or some such.
If you search here on d.o, you'll find some other similar scripts posted.
Make sure you chmod 700 the script, and substitute below the relevant values for your mysql account for
<USERNAME> <PASSWORD> <DATABASE>, and change "mysite" to your site name (if desired).---
Work: BioRAFT
yes I am on Linux server but
yes I am on Linux server but I am already using one cron on cpanel. Can you tell me how to set multiple crons through cpanel (I don't have ssh access). I hope the script is safe :). the "-f" option is always scarier to me..the last thing I want is to completely erase my site
Regards
also cpanel
I'm also doing it on cpanel- it should be as easy as visiting the "Coron jobs" page (pick "standard")- there will be another blank spot to add a new one each time you visit it (at least for me there is).
Then just put in something like this for the command:
And set it to run once a day late at night or early morning.
---
Work: BioRAFT
Help! I want to backup my entire Drupal website and database
I know very little about software. Drupal is such an amazing software that its easy to learn. Please tell me if there is a module for 5.1 which will back up by itself. I dont know php or mysql or chmod etc..i see these terms being used :)
I can follow basic instructions...so is there something for a dummy like me :)
Backup for dummies....i would prefer to back the entire site and database everyday...on the server itself..and make a local copy on my computer once a week....and a system which deletes old copies a week old..and installs the latest one is a great idea..
someone please help me on this.
thanks.
Actually I am myself not
Actually I am myself not able to solve my cpanel problem. I am still working on it. If I could do something about it than will surely post it
Cheers
I NEED HELP!
everytime I try to implement the php back up script (Im not even to adding a cron job yet!) I get the following error: Warning: filesize() [function.filesize]: stat failed for /home/antsocom/backup.24.tar.gz in /home/antsocom/public_html/dirtybirddesignlab.com/backup.php on line 5
I really dont know what to do and any help would be much appreciated.
Thank you
---
Before you go to this kind of trouble, insure that your host doesn't already make backups for you. Esepcially of your files..... Many do. If yours however does not continue to read on.
USE AT YOUR OWN RISKWhat I use:
for website files
Here is a php script that will create a compressed backup of your website files, creating a different file each day for a month (then start over) so you have 30 days of backups. It will email you with a backup confirmation. Run it every night using cron to kick it off. You should download the backup files from the server on a regular basis.
If you want to exclude a directory, add the --exclude parm to the tar command as shown in the example below (which will exlcude the public_html/audio directory):
system("tar --create --preserve --gzip --file=".$target." --exclude ~/public_html/audio ~/public_html ~/mail",$result);Please note that this script is very resource intensive. Do not run it more than once a day, and do not run it at peak times. If you have a large site the script may timeout depending on the server settings, but the backup may still be created.
Before using cron, run the script from your browser to make sure it works as anticipated.
Set a cron job to run the script once a day (at an odd time - like 4:23am - to minimize server load issues).
This example backs up the public_html and mail directories.
The backup file (named backup.XX.tar.gz) will be created in your root directory (above public_html).
for MySQL
Here is a php script that will backup your MySQL database, creating a different file each day for a month (then start over) so you have 30 days of backups. It will email you with a backup confirmation. Run it every night using cron to kick it off. Replace the X's with your information. You should also download the backup files from the server on a regular basis.
You can restore the database using the following line in a php script:
system( "mysql --user=$dbuser --password=$dbpswd --host=$host $mysqldb < $filename",$result);Note that hosts may have different paths for the mysql commands. For example /usr/local/bin/mysqldump could be required.
If you want the backup file to be compressed, then change two lines (the $filename variable and the system() command) as follows:
Thanks alot. So I have
Thanks alot. So I have creatd a backup folder in my public_html folder and than createa bacckup.php file with 755 permissions. Than edited it appropriately by putting my database info. Now I am going to put it in cron. That's it. Right ?
Anything I need to be careful of ?
Edit - Ok, I just executed the php script and got the following message in my mailbox
Obviously theew was no database created. Is there any permission problems here ? because everything seems to be OK.
also when I open the page
also when I open the page http://mysite.com/backup/backup.php , it gives the error
Warning: filesize() [function.filesize]: Stat failed for /home/mysite/public_html/backup/05.sql (errno=2 - No such file or directory) in /home/mysite/public_html/backup/backup.php on line 10
you can probably remove the
you can probably remove the mail backup, since I have no idea where your mail folder is stored.
witout seeing how you altered the paths, there is no way for me to bebug why this won't work in your environment. There are no guarantees that it will work for you. I store my backups above the public root, not in it. This was written to work in my environment and may need some tweaking to work in yours. Maybe posting it to your hosts support forum would be fruitful.
as stated above:
If your host is site5.com these scripts should work without issue. if you are on a different host, There could be bumps in road, or they just may not work at all.
Bash scripts to backup database and public_html for last 7 days
Hi, I've wanted to have a daily backup for only one week of public_html and of database. I found this old thread and wanted to post what I did so maybe it helps others.
I've created to bash scripts wich I put on the root of my site with executable privileges, and call them to run once a day during low traffic hours from cron job.
And the scripts are:
and:
%a stands for short weekday, and as I omitted day and month, I only get backup of the last week only.
Cheers,
Mguel
PS: any correction or improvement is welcome since I'm not a programmer nor nothing near.
clarification...
Thanks for posting these scripts!
Small clarification: you put the scripts in the root directory for your site, and where are files created? Are they also created in the root directory?
For example, if you just have one site and it's in public_html, you would put these scripts in public_html, and then where will the files get created?