BitterSweetJaVa

March 6, 2009

MySql Database Backup & E-Mail (2)

Filed under: Linux, MySQL, SQL — Tags: , , , — .|2ic|K @ 6:33 PM

Well, now that we have the email script working (at least it Worked for me), let’s create a job using cron to execute it on a regular basis.

First of all, I created a new cron file under /etc/cron.d/ called dbBackup.
The file contains a simple cron expression:

0 20 * * 5 root /etc/init.d/dbBackup &

Basically, this will:

  • Execute the command /etc/init.d/dbBackup
  • The execution will be as a background process (&)
  • The schedule will be every friday at 8:00pm
  • The user that will execute it will be root.
  • In this case, /etc/init.d/dbBackup is the script that I posted previously to make a backup of the MySql database.
    I’ve just received the first scheduled email an hour ago!

    For more info on cron syntax, you can visit this site.

    Theme: Shocking Blue Green. Blog at WordPress.com.

    Follow

    Get every new post delivered to your Inbox.