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

cron job

Options
  • 04-09-2004 12:24pm
    #1
    Registered Users Posts: 1,459 ✭✭✭


    hello can someone give me a cron job script for emailing a sql database to myself every day from my cPanel, on my server


Comments

  • Registered Users Posts: 1,459 ✭✭✭Heathen


    do i make sence?


  • Registered Users Posts: 3,886 ✭✭✭cgarvey


    do i make sence?

    Nope, but you do kinda make sense! ;)

    So this shell script will dump, db, tar/gzip it up, and mail it as an attachment to the specified address.. you'll probably want to handle errors a bit better.

    You can just put it in /etc/cron.daily
    #!/bin/sh
    
    cd /root
    mysqldump db_name > db.sql
    tar -zcf db.tgz db.sql
    uuencode db.tgz db.tgz | mail me@mydoamin.com
    rm db.sql
    rm db.tgz
    

    This script is assumed to run as root on a cPanel server (as root, by default, has mysql connection details stored in ~/.my.cnf)

    HTH
    .cg


Advertisement