Automate Your Website File and MySQL Backups

Part 3 – Backing Up Your Files

If you were following along in part 2, you should have already created a folder on your web server for temporarily storing your file backups. If not, you will need to create the following folder:

Create a second cron job. Copy and paste the following code into the command box:

tar -cvzpf /home/CpanelUsername/backups/files/CpanelUsername-files-$(date --iso).tar.gz /home/CpanelUsername/public_html

Remember to change CpanelUsername for your specific situation. Schedule the job to run once per day. If you’ve scheduled your database backups for 3 AM, then 4 AM would probably be a good time for this job to run. If your public web folder (document root) is something other than public_html, then you will need to change the path to point to your public web folder.

This command will make a copy of everything in your public_html folder, archive it, compress it, and then store the compressed file in the files folder you created earlier. If there are other folders you would like to include in this archive, you can add the path to the end of this command like so:

tar -cvzpf /home/CpanelUsername/backups/files/CpanelUsername-files-$(date --iso).tar.gz /home/CpanelUsername/public_html /home/path-to-other-directory

That’s it for backing up your files. On the next page, I’ll show you how to use WinSCP to schedule daily retrievals of those backups and store them on your local PC.

Next page – Retrieving Your Backups.

This entry was posted in Website Administration, Website Backups and tagged , , , , . Bookmark the permalink.

11 Responses to Automate Your Website File and MySQL Backups

  1. Ryann Lalata says:

    I am glad to finally learn this. Thanks!

  2. Sounds very intersting.This helps me to learn something new.Thanks.

  3. Gena Nett says:

    Terrific, this information is exactly what I was searching for.

  4. Your Article is Very HelpFull , Thank you very much

  5. Pretty nice post. I just stumbled upon your blog and wished to say that I’ve truly enjoyed browsing your blog posts. In any case I will be subscribing to your rss feed and I hope you write again soon!

  6. I’ll be sharing this with my network. Very pleased with your style, thanks! I will come here again.

  7. Helpful information here. I added your site on my favorite, so visit again.

  8. I have to tell, that this article is great! Thanks for providing the such a wonderful article, you have assembled a tremendous amount of useful data here. So thanks again.

  9. Bobbi Carey says:

    What a great post

  10. Simply wanna input that you have a very nice site, I love the pattern it really stands out.

  11. humanizer says:

    There are a few excellent suggestions here. I need to renovate my own blog site a while. My goal is to begin from the start these times I think.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Proudly powered by WordPress.
preloaded image preloaded image preloaded image preloaded image preloaded image