Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Want to use crontab to set dbase backup

Options
  • 20-01-2006 1:07pm
    #1
    Registered Users Posts: 461 ✭✭


    Hi there,
    I have entered the world of cron jobs and am less than experienced!

    I want to use crontab manager in my webhosting control panel to automate dbase backups...

    I think this should work for a database backup:

    In a db_backup.pl file: run from the crontab manager at a specific time.

    /usr/bin/nice -20 /usr/bin/mysqldump -q --hdbhost.com --user=username --password=password dbname /usr/www/users/ourname/backup/database_name _`date "+%Y%m%d"`.sql ; cd /usr/www/users/ourname/backup ; /usr/bin/find *.sql -mtime +7 -delete
    >/dev/null 2>&1

    ##comments###
    # hostprovider want us to nice the task with val 10+
    # -q to avoid exceeding memory lims for large tables
    # host user and pass and dbname provided
    # output to database_name with date.sql
    # change dir to the backup folder
    # delete any .sql older than 7 days
    #If any output is produced by a command executed from a crontab, the cron daemon will normally email the user that output.
    #thus >/dev/null 2>&1
    #
    #could change dir to a success_email.txt and send that email to me@myhost.com
    #not sure of the syntax to do this
    #how can we find out about errors?

    I would value input from anyone who is familiar with this task.
    I'd love a report emailed to me of success / fail etc

    Cheers


Advertisement