+ Reply to Thread
Results 1 to 12 of 12
  1. Join Date
    Aug 2003
    Location
    England
    Posts
    1,095
    Thanks
    1
    Thanked 2 Times in 1 Post

    How to backup your mysql based site using CRON in cpanel

    I haven't actually cracked this yet, but hopefully with the input of some forum members we can get to a solution that others will find useful in the future.

    I backup my wordpress blogs with: WordPress Database Backup

    But I have a wpmu site which I haven't found a suitable solution for and also some other sites which are mysql based that I want to backup, I think the best way is to set up a CRON job, which I can do on some sites via ssh or via the cpanel menu on some others. So he are some codes snippets I have found so far:
    /usr/local/bin/mysqldump --default-character-set=utf8 --user=username --password=password --quote-names --complete-insert --extended-insert --quick --compact --lock-tables=false --skip-add-locks --all-databases | gzip > /home/path/backup/`date "+%Y.%m.%d"`.gz
    I can't say I have much of a clue how to use the code snippets yet, or how to even get started emailing myself a backup, but I'll get there eventually, maybe even with some of your help, so if you know what you are doing can you help me out

    My idea is to have 7 backups on my site at any one time. Number 1 through 7 they get overwritten weekly, so as to not been storing too much. I also want to email myself the backup on a weekly or daily basis depending on which of my sites it is.

    I think that if I can use `date "+%d"`it will give me a backup for each day of the month, I know in php w gives me a numeric representation of the day of the week, which is what I am after here, not sure if it is the same for a cron job though.

    Anyway I'm off to do some more digging, if you can help with any of this, let me know, I'm learning as I go here.

    affiliates4u Fantasy Football Winner 2007/08

  2. Join Date
    Jan 2008
    Posts
    434
    Thanks
    2
    Thanked 18 Times in 18 Posts

    Re: How to backup your mysql based site using CRON in cpanel

    cant help, but would be thankful if you post a quick 'how to' when you get it sorted!!

  3. Join Date
    Aug 2003
    Location
    England
    Posts
    1,095
    Thanks
    1
    Thanked 2 Times in 1 Post

    Re: How to backup your mysql based site using CRON in cpanel

    that is the plan jezaff will post updates on how I get on and solution here at the end

  4. Join Date
    Aug 2003
    Location
    England
    Posts
    1,095
    Thanks
    1
    Thanked 2 Times in 1 Post

    Re: How to backup your mysql based site using CRON in cpanel

    ok I've already realised I was trying to be too clever, to backup the whole database daily, I can go with:


    0 3 * * 0 mysqldump --user=username --password=xxxx databasename /home/sitename/public_html/backups/Sundaybackup.sql
    0 3 * * 1 mysqldump --user=username --password=xxxx databasename /home/sitename/public_html/backups/Mondaybackup.sql
    0 3 * * 2 mysqldump --user=username --password=xxxx databasename /home/sitename/public_html/backups/Tuesdaybackup.sql
    0 3 * * 3 mysqldump --user=username --password=xxxx databasename /home/sitename/public_html/backups/Wednesdaybackup.sql
    0 3 * * 4 mysqldump --user=username --password=xxxx databasename /home/sitename/public_html/backups/Thursdaybackup.sql
    0 3 * * 5 mysqldump --user=username --password=xxxx databasename /home/sitename/public_html/backups/Fridaybackup.sql
    0 3 * * 6 mysqldump --user=username --password=xxxx databasename /home/sitename/public_html/backups/Saturdaybackup.sql


    which will backup to the /backups/ directory which needs to exist at 3am each day of the week. (/home/sitename/public_html/ is my base directory, yours could be different such as just /public_html/ or /var/www/html).

    more to come soon and also a report back after the first 3am trial run

    not sure if I need the --password=xxxx bit, think as it is local it will work without, will find out....

  5. Join Date
    Aug 2003
    Location
    England
    Posts
    1,095
    Thanks
    1
    Thanked 2 Times in 1 Post

    Re: How to backup your mysql based site using CRON in cpanel


  6. Join Date
    Dec 2006
    Posts
    1,998
    Thanks
    0
    Thanked 19 Times in 19 Posts

    Re: How to backup your mysql based site using CRON in cpanel

    If you have PHP available, you can have a more advanced solution, which backs up your database and sends it by FTP to another computer. This can be another server or your home computer if its on a static ip.

    If you're interested then let me know, as I wrote one a while back which I can dig out.

  7. Join Date
    Aug 2003
    Location
    England
    Posts
    1,095
    Thanks
    1
    Thanked 2 Times in 1 Post

    Re: How to backup your mysql based site using CRON in cpanel

    I do have php available, sounds very good, I would be interested in the code

  8. Join Date
    Dec 2006
    Posts
    1,998
    Thanks
    0
    Thanked 19 Times in 19 Posts

    Re: How to backup your mysql based site using CRON in cpanel

    Ok, I`ll dig it out for you when I get a chance.

    I actually did an article about it as well which explained the development, so if I`ve still got a copy of that i`ll pass that on too.

  9. Join Date
    Aug 2003
    Location
    Allt Y Coed Farm, North Pembrokeshire
    Posts
    3,808
    Thanks
    214
    Thanked 140 Times in 106 Posts

    Re: How to backup your mysql based site using CRON in cpanel

    Yep I would be interested in that too please tbp.

    Thanks

    Baz

  10. Join Date
    Dec 2006
    Posts
    1,998
    Thanks
    0
    Thanked 19 Times in 19 Posts

    Re: How to backup your mysql based site using CRON in cpanel

    No problem!

    Its not actually on my PC at the moment since I upgraded earlier in the year, so i`ll have to dig out my backup disks. I`ll do this in the next couple of days and then PM you both details of how to get it.

  11. Join Date
    Aug 2003
    Location
    Allt Y Coed Farm, North Pembrokeshire
    Posts
    3,808
    Thanks
    214
    Thanked 140 Times in 106 Posts

    Re: How to backup your mysql based site using CRON in cpanel

    Thanks.

    Baz

  12. Join Date
    Jan 2005
    Location
    Cumbria, UK
    Posts
    665
    Thanks
    5
    Thanked 15 Times in 15 Posts

    Re: How to backup your mysql based site using CRON in cpanel

    If it's Cpanel (as in the product called that) then what I do is use Getright and it's daily download feature to backup all the databases. It can do the naming you mentioned using special replace codes.

    I just point it at the URL provided for dbase backups in Cpanel and it logs in and does the download for me. Handy when you're doing this across about 120 odd sites.

    Actually that's not a bad idea replacing the download....might solve one of my current problems with the backups getting stupidly big!

    Trev

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Affiliate site not listed on Dmoz.org here is why!
    By supercod in forum Media Coverage & PR Strategy
    Replies: 32
    Last Post: 14-03-08, 12:31 PM
  2. Negative Site Feedback
    By bulbo in forum Affiliate Marketing Lounge
    Replies: 37
    Last Post: 15-05-04, 06:39 PM
  3. cPanel View Site Before Live
    By morleymouse in forum Web Hosting & Security
    Replies: 9
    Last Post: 16-01-04, 05:19 PM
  4. backup if site is down?
    By emma in forum Affiliate Marketing Lounge
    Replies: 8
    Last Post: 21-08-03, 06:28 AM
  5. ARELIS 3 Link Popularity Software
    By Qui Gon Jinn in forum Media Coverage & PR Strategy
    Replies: 4
    Last Post: 05-03-03, 07:34 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Content Relevant URLs by vBSEO 3.5.0 RC1 PL1