- Jan 2, 2023
- 2,003
- 247
Get cPanel Website Database Backups Sent Directly to Your Computer With Windows Live Mail. Easy Solu
A lot of you need off-site database backups on the fly. Well with Windows Live Mail you have that option by using this email script attached below for your database. Be noted this script only works with cPanel.
Windows Live Mail is a mail client that can receive your emails from any mail server or email and keep them without leaving a copy of them on the parent server.
I use it for emailing my database backup to me once ever 6 hours. You can have it sooner than that if you have the right script.
Download the script below in the attachments and try it for yourself. When you set it up, simply do this. Go to Windows Live Mail and click Accounts > Properties > Advanced > uncheck leave a copy of message on server.
After doing that you'll be setup to receive the emails only to your mail client so you won't be taking space up on your email. I use my website admin email to receive the backups and then have it transferred to Windows Live Mail. For many this will be the best option. Do note that gmail and yahoo has a limit for attachments. Cloud storage can be an option for some if you have that, however I have not tried this method. So for most of you the best method will be using your admin website email.
You also don't need an mx entry for the mail to be sent.
I will now explain how to use this backup script and also I have provided it as an attachment for anyone who decides they want to use this Windows Live Mail method. I assure you the method is a very smart and good way to keep your database download available as it goes directly to your PC and doesn't even stay on the server when following the instructions above.
First off you'll need to download the script provided in the attachment.
Next use a coding editor like Sublime Text or notepad++ to edit "backup.php". This is the file you'll need to edit. It's a few simple edits just so you can put in your database details. When you see it you'll know what to edit. But for the sake of knowledge I will tell you specifically. Edit the database username, database password, database name, sendfrom, and sendto areas. In the sendfrom area you need to put your website host name in the brackets where it says "http://admin@hostname.com". In the sendto area you need to put your admin or webmaster email address. For most people it would be http://admin@domain.com or whatever your site is.
After that ftp the files to your server.
Once you do that make sure "backup.php" has file permissions settings of 777. After you set the file permissions on backup.php all that's left is to edit your CRON file so that the system knows how often and knows when to email you the backup.
You will need to download puTTy or have SSH access to edit your CRON. If you are not familiar with pUTTy search it in google and download it. The rest is self explanatory. You simply put in your ip address and login as the root user. If you don't have a VPS or dedicated server and you have shared hosting you'll need to ask your host to do this for you.
Okay once you have puTTy open type this command. First part is for setting the CRON editor so you can edit the file. There are a number of editors you can use. I chose nano because it's the easiest to use. Second part is to actually open up your CRON:
Now the cron will come up. You can search on google how different
timings work for the cron. I will show you how to get it mailed to you
every 4 hours. Feel free to set it up for another time period. I'm also
putting path/to/file in place of the location of backup.php. You'll need
to change the file path if it's somewhere else.
In your cron file, type this on a blank line:
Now the php -q part is for setting the php path so your system
knows what kind of file it's going to execute which is a php file.
Without it you'll receive a lot of emails from the cron daemon saying
that it doesn't know the file path so this is important. The next part "> /dev/null 2>&1" is just to
keep emails from being sent to you about the cron edit. You still may receive some once in a while but it's mainly
meant to keep that from happening.
Now after you've done this you will receive the email of your database
to Windows Live Mail (if you've followed instructions above and signed
in with your webmaster email) every 4 hours.
If you want to test for 1 minute to see if it works you can use this
cron setting instead and just replace the above with this (remember to
set your real file path to backup.php) before changing it to what you
want:
And there you have it. The best database backup solution on the planet. Receive an email with your database to Windows Live Mail any time period you choose and uncheck leave a copy on server to that it only goes to your computer. And nothing stays on your server. Directly to your computer only.
I hope this helps you guys. If you need support setting it up just let me know and I will do my best to help.
A lot of you need off-site database backups on the fly. Well with Windows Live Mail you have that option by using this email script attached below for your database. Be noted this script only works with cPanel.
Windows Live Mail is a mail client that can receive your emails from any mail server or email and keep them without leaving a copy of them on the parent server.
I use it for emailing my database backup to me once ever 6 hours. You can have it sooner than that if you have the right script.
Download the script below in the attachments and try it for yourself. When you set it up, simply do this. Go to Windows Live Mail and click Accounts > Properties > Advanced > uncheck leave a copy of message on server.
After doing that you'll be setup to receive the emails only to your mail client so you won't be taking space up on your email. I use my website admin email to receive the backups and then have it transferred to Windows Live Mail. For many this will be the best option. Do note that gmail and yahoo has a limit for attachments. Cloud storage can be an option for some if you have that, however I have not tried this method. So for most of you the best method will be using your admin website email.
You also don't need an mx entry for the mail to be sent.
I will now explain how to use this backup script and also I have provided it as an attachment for anyone who decides they want to use this Windows Live Mail method. I assure you the method is a very smart and good way to keep your database download available as it goes directly to your PC and doesn't even stay on the server when following the instructions above.
First off you'll need to download the script provided in the attachment.
Next use a coding editor like Sublime Text or notepad++ to edit "backup.php". This is the file you'll need to edit. It's a few simple edits just so you can put in your database details. When you see it you'll know what to edit. But for the sake of knowledge I will tell you specifically. Edit the database username, database password, database name, sendfrom, and sendto areas. In the sendfrom area you need to put your website host name in the brackets where it says "http://admin@hostname.com". In the sendto area you need to put your admin or webmaster email address. For most people it would be http://admin@domain.com or whatever your site is.
After that ftp the files to your server.
Once you do that make sure "backup.php" has file permissions settings of 777. After you set the file permissions on backup.php all that's left is to edit your CRON file so that the system knows how often and knows when to email you the backup.
You will need to download puTTy or have SSH access to edit your CRON. If you are not familiar with pUTTy search it in google and download it. The rest is self explanatory. You simply put in your ip address and login as the root user. If you don't have a VPS or dedicated server and you have shared hosting you'll need to ask your host to do this for you.
Okay once you have puTTy open type this command. First part is for setting the CRON editor so you can edit the file. There are a number of editors you can use. I chose nano because it's the easiest to use. Second part is to actually open up your CRON:
Code:
export VISUAL=nano; crontab -e
timings work for the cron. I will show you how to get it mailed to you
every 4 hours. Feel free to set it up for another time period. I'm also
putting path/to/file in place of the location of backup.php. You'll need
to change the file path if it's somewhere else.
In your cron file, type this on a blank line:
Code:
0 */4 * * * php -q /path/to/file/backup.php > /dev/null 2>&1
knows what kind of file it's going to execute which is a php file.
Without it you'll receive a lot of emails from the cron daemon saying
that it doesn't know the file path so this is important. The next part "> /dev/null 2>&1" is just to
keep emails from being sent to you about the cron edit. You still may receive some once in a while but it's mainly
meant to keep that from happening.
Now after you've done this you will receive the email of your database
to Windows Live Mail (if you've followed instructions above and signed
in with your webmaster email) every 4 hours.
If you want to test for 1 minute to see if it works you can use this
cron setting instead and just replace the above with this (remember to
set your real file path to backup.php) before changing it to what you
want:
Code:
*/1 * * * * php -q /path/to/file/backup.php > /dev/null 2>&1
I hope this helps you guys. If you need support setting it up just let me know and I will do my best to help.