The script to backup database file and website file:

#! /bin/sh


#Format the date in YEAR-MO-DY format
TODAY=`date +%d%b%Y`

# Set the Apache Configuration backup name to the following
# Set the web directory backup name to the following

# Set database backup name to the following

#this tars up the apache configuration files
/bin/tar -czf $TMP$CFG_FILENAME /etc/httpd/conf*

#Move the apache configuration file to the backup directory

/bin/mv $TMP$CFG_FILENAME /tmp
# this tars up my web directory into web.tar.gz tarball.
/bin/tar -czf $TMP$WEB_FILENAME /var/www/html/mci

# Move the web back to the backup directory
/bin/mv $TMP$WEB_FILENAME /tmp

# Remove web backup file from temp director

# this tars up my database directory into $TODAY-db.tar.gz tarball. note that there is no space between -p and PASSWORD

mysqldump -u root -pPASSWORD -B WP_DB | gzip > $TMP$DB_FILENAME

# Move the backup database to the backup directory
/bin/mv $TMP$DB_FILENAME /tmp


Save this script as /var/scripts/


use crontab -e to schedule this script:


0 0 * * 1,4 /var/scripts/