1 (edited by hata_ph 2010-06-21 14:04:25)

Topic: No backup script for iRedOS6 [SOLVED]

Just tested iRedOS 6 and notice there is no backup script under /root/iRedMail/tools. There is a iRedMail_backup script when I tested on iRedOS 5.....

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: No backup script for iRedOS6 [SOLVED]

You can use the old one :-)

3 (edited by hata_ph 2010-06-16 11:32:01)

Re: No backup script for iRedOS6 [SOLVED]

ZhangHuangbin wrote:

You can use the old one :-)

The backup_MySQL.sh is not working....showing this error...

ls: /root/db/2010.06.16/*: No such file or directory
du: cannot access '/root/db/2010.06.16/*': No such file or directory

below is my backup_MySQL.sh

#!/usr/bin/env bash

# Filename: backup_mysql_db.sh
# Author:   Zhang Huangbin (michaelbibby <at> gmail.com)
# Date:     2007.09.16
# Purpose:  Backup specified mysql databases.

# Copyright:
#
# This shell script is shipped within iRedMail project, released under
# GPL v2.
# ----

# Usage:
#   * Add crontab job for whichever user, such as root:
#
#       # crontab -e -u root
#       1   4   *   *   *   /bin/sh /path/to/backup_mysql_db.sh
#   
#   * Make sure 'crond' service is running when system startup:
#
#       # chkconfig --level 345 crond on
# ----

# -----------------------------------------------------------------
# ---- Modify below variables to suit your need ----
# -----------------------------------------------------------------
# Where to store backup copies.
#BACKUP_ROOTDIR='/backup/mysql/'
BACKUP_ROOTDIR='/root'

# MySQL user and password.
MYSQL_USER='root'
MYSQL_PASSWD='xxxxxxx'

# Which database(s) we should backup.
DATABASES="mysql iredadmin policyd roundcubemail"

# Database character set.
DB_CHARACTER_SET="utf8"

# Compress: YES | NO.
COMPRESS="YES"

# Delete plain SQL file after compressed. Compressed copy will be
# remained.
DELETE_PLAIN_SQL_FILE="YES"

# -----------------------------------------------------------------
# ---- You do *NOT* need to modify below lines. ----
# -----------------------------------------------------------------
MONTH="$(/bin/date +%Y.%m)"
DATE="$(/bin/date +%Y.%m.%d)"

BACKUP_DIR="${BACKUP_ROOTDIR}/db/${DATE}"

# Check necessery directory.
[ -d ${BACKUP_DIR} ] || mkdir -p ${BACKUP_DIR}

# Logfile directory.
LOG_DIR="${BACKUP_ROOTDIR}/logs/${MONTH}/"
[ -d ${LOG_DIR} ] || mkdir -p ${LOG_DIR}

LOGFILE="${LOG_DIR}/backup-mysql-${DATE}.log"

# create and init log file.
echo -e "\nLog init at: ${DATE}." >${LOGFILE}
echo "Operator: Michael Bibby(michaelbibby@gmail.com)." >>${LOGFILE}
# ---- End log ----

backup_db()
{
        # USAGE:
        # backup dbname
        output_sql="${BACKUP_DIR}/${1}-${DATE}.sql"

        mysqldump \
        -u${MYSQL_USER} \
        -p${MYSQL_PASSWD} \
        --default-character-set=${DB_CHARACTER_SET} \
        $1 > ${output_sql}
}

# Backup.
for i in ${DATABASES}
do
        echo -n "Backup database: $i..." >> ${LOGFILE}
        backup_db $i
        echo -e "\tDone" >>${LOGFILE}
done

# Compress plain SQL file.
if [ X"${COMPRESS}" == X"YES" ]; then
    for i in $(ls ${BACKUP_DIR}/*)
    do
        echo -n "Compress: $i..." >>${LOGFILE}
        bzip2 $i
        echo -e "\tDone" >>${LOGFILE}
    done
else
    :
fi

# Size of the backup file.
du -sh ${BACKUP_DIR}/* >>${LOGFILE}

# Delete plain SQL file after compressed.
if [ X"${DELETE_PLAIN_SQL_FILE}" == X"YES" ]; then
    rm -f ${BACKUP_DIR}/*sql
else
    :
fi

4

Re: No backup script for iRedOS6 [SOLVED]

Do anyone have any idea on the SQL backup script cause I want to test on how to backup and restart iRedOS/iRedMail with the ldap backend...

5

Re: No backup script for iRedOS6 [SOLVED]

Stupid me...it seem I have some typo error in the script...pls ignore this....

6 (edited by billybons2006 2010-07-08 20:42:57)

Re: No backup script for iRedOS6 [SOLVED]

/root/iRedMail/tools

Are this tools available in iRedMail 6 (not iRedOS)?