Results 1 to 8 of 8
  1. #1

    Cron Job for Automatic Backup

    Im currently making manuel mysql back and must say it sucks.

    I need a solution where I can set a automatic cronjob command via ssh and it backup the file every 12 hours twice a day.

    And it has to be compressed in .gzip format to make it handleable for regular DSL users.

    Also I need a solution that sets the time on the file like backup11.41am.tar.gzip or something similar with date and time.

    Can someone make a command and post here make sure you also instruct me on how to set it on SSH mode. and how I can stop the command in future if necassary.

  2. #2
    my god all these people here and no one knows this??

  3. #3
    There's TONS of sample bash scripts on the net, just do a google search.
    Linux/BSD Systems Administrator

  4. #4
    Join Date
    Nov 2005
    Location
    Seattle, WA
    Posts
    648
    Either that or hire a coder

  5. #5
    Get the path to your database and do something similiar to this every 12 hours, deleting the original tar file before you run it by issuing an 'rm -f'

    tar cvf /var/lib/mysql/db_name /backups/db_name.tgz

  6. #6
    Join Date
    Dec 2005
    Location
    Internet
    Posts
    1,352
    1) Setup SSH keys between the 2 servers
    2) create the script that has to be executed as cron. a sample code below:

    tar cvf /var/lib/mysql/database /backup/databasename.tgz
    scp /backup/databasename root@IP:/backup/

    3) Setup the scipt as a cron job to execute every 12 hours.

    Let us know how it goes.

  7. #7
    thanks all on google

  8. #8
    Join Date
    Nov 2004
    Location
    Australia
    Posts
    1,737
    Just write a PHP script that exports the database, and call it every few hours. It's not that hard, although getting it running robustly and well isn't trivial either.

Posting Permissions

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