[cPanel] Auto MySQL backup

Discussion in 'Tutorials' started by Stanz, Mar 18, 2005.

  1. Stanz

    Stanz New Member

    Messages:
    76
    Likes Received:
    0
    Trophy Points:
    0
    Download the script, attached below.

    Open the .php file in the attached .zip file & edit it.
    Upload the script to your site (create a new directory) for example yoursite.com/sqlbackup.
    CHMOD the new directory (folder) to 777.

    Go to your CPanel and click on Cron Jobs. Then click on Standard.

    Where it says "Command to run:" type
    Change the username to your username, and edit the path to where the script is located.

    Set the time you want the Cron Job to run in the Minute(s) and Hour(s) boxes.

    Warning: Do not do this in Hour(s) or Minute(s) or you account can be suspended for too much CPU usage. Here's the rest of the instructions:

    Now it's time to say when it will backup the DBs. If you want to run it once a week, pick a day from the Weekday(s) box. If you want to run it once a month, select a date from the Day(s) box and leave the Month(s) box at Every Month.

    Click Save Crontab and you're done.

    Note: This only works for cPanel software.
    You may use the script to backup if u dont have cPanel.
    But you wont be able to use this tutorial without cPanel.

    PS: You can make the script to email the backup,
    or upload it to the directory you set in the script.. (requires setup)
    This is only mySQL backup, not the whole site!!
    and em.. its very usefull for forums..
     

    Attached Files:

  2. Corey

    Corey I Break Things Staff Member

    Messages:
    34,553
    Likes Received:
    202
    Trophy Points:
    63
    Nice post, thanks Stanz :)

    -Corey
     
  3. Stanz

    Stanz New Member

    Messages:
    76
    Likes Received:
    0
    Trophy Points:
    0
    :biggrin: thanks
    anyway, you can also just run the script.
    if u want to backup manual...
    that might save the server.. :smile:
     
  4. Origin

    Origin New Member

    Messages:
    1,082
    Likes Received:
    0
    Trophy Points:
    0
  5. brAddict

    brAddict New Member

    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    I've done everything requested but the cron still doesn't work.

    Permissions are :

    0777 for the folder where the file is.
    0644 for the file itself (SQLBackup/backupdb.php)
    User created for the database backup has those privileges :

    select, insert, drop, create

    This is what I receive by email :

    /bin/sh: /home/braddict/public_html/SQLBackup/backupdb.php: Permission denied

    When I try to execute the file from the site itself, this is what it shows :

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.


    --

    Any ideas ??
     
  6. *Face

    *Face New Member

    Messages:
    62
    Likes Received:
    0
    Trophy Points:
    0
    The backupdb.php file needs execute permission, so it will probably need to be CHMOD to 755.
     
  7. masshuu

    masshuu Head of the Geese Community Support Enemy of the State

    Messages:
    2,293
    Likes Received:
    50
    Trophy Points:
    48
    hello, im getting the folowing email when its run with the cron, but it works fine when i run it via web browser.
     
  8. alquimistabiologico

    alquimistabiologico New Member

    Messages:
    194
    Likes Received:
    0
    Trophy Points:
    0
    Wow, that's a very usefull script.

    Thanks budy
     
  9. simon.evanz48

    simon.evanz48 Member

    Messages:
    32
    Likes Received:
    0
    Trophy Points:
    6
    Thanks for your CRON example DB Backup script, I will give it a whirl to see what's what.
     

Share This Page