Hi Eric,
Please see below script.
which qt-config >/dev/null 2>&1
if [ $? == 0 ]; then
. qt-config -s
fi
: ${backupdest:=/bkhdd/backup/mailbkup} # Where do you want the backups (no
trailing slash)
: ${useftp:=n} # Use FTP for backups?
: ${ftpserver:=ftp://} # Define your FTP account here
(ftp://user:pass@ip)
: ${emailinfo:=n} # Do you want emails to be sent to you
with backup info?
: ${email:=postmaster} # Define email to be sent to (
[email protected])
: ${removeprevious:=n} # Do you want to remove the previous
backup?
: ${includemaildirs:=y} # Do you want to include the actual
mail?
: ${includesquirrelmail:=y} # Do you want to include squirrelmail?
# set MYSQL variables, if not already set by qt-config
: ${mysql_file:=~vpopmail/etc/vpopmail.mysql}
if [ -f $mysql_file ]; then
: ${mysql_host:=$(cut -d\| -f1 < $mysql_file)}
: ${mysql_port:=$(cut -d\| -f2 < $mysql_file)}
: ${mysql_user:=$(cut -d\| -f3 < $mysql_file)}
: ${mysql_password=$(cut -d\| -f4 < $mysql_file)}
: ${mysql_database=$(cut -d\| -f5 < $mysql_file)}
fi
################################
# Actual Backup Script Below #
################################
#echo " $me $myver"
if [ ! -d $backupdest ] ; then
mkdir -p $backupdest
fi
# assigning backup filenames with date
DATENAME=`date +%Y%m%d%H%M`
QMAILCONTROL="$DATENAME-qmailcontrolusers.tar.bz2"
SQMAILPREFS="$DATENAME-squirrelmail-prefs.tar.bz2"
SQMAILPLUGS="$DATENAME-squirrelmail-plugins.tar.bz2"
QMAILADMINPASSWD="$DATENAME-qmailadminpasswd.tar.bz2"
SPAMASSASSINFILES="$DATENAME-spamassassin-files.tar.bz2"
VPOPMAIL="$DATENAME-vpopmail.tar.bz2"
DATABASE="$DATENAME-vpopmail.sql"
gzmysqldata="$DATENAME-vpopmail.sql.gz"
curlfile="$DATENAME-backup.tar.gz"
if [ $removeprevious = y ] ; then
# echo "Removing old backup file"
rm -rf $backupdest/*-backup.tar.gz
fi
starttime=`date +%a-%D-@-%X-%Z`
if [ "$includesquirrelmail" == "n" ]; then
touch $backupdest/$SQMAILPREFS \
$backupdest/$SQMAILPLUGS
else
#echo "Backing up Squirrelmail user prefs and address books"
tar -C /var/lib/squirrelmail \
-cjf $backupdest/$SQMAILPREFS prefs > /dev/null 2>&1
#echo "Backing up Squirrelmail plugins"
tar -C /usr/share/squirrelmail \
-cjf $backupdest/$SQMAILPLUGS plugins > /dev/null 2>&1
fi
#echo "Backing up qmail config users files"
# We now back up the ENTIRE control dir, per request
tar -C /var/qmail \
-cjf $backupdest/$QMAILCONTROL control users > /dev/null 2>&1
#echo "Backing up old /admin-toaster/ password"
tar -C /usr/share/toaster/include \
-cjf $backupdest/$QMAILADMINPASSWD admin.pass admin.htpasswd
#echo "Backing up SpamAssassin files"
tar -C /home/vpopmail \
-cjf $backupdest/$SPAMASSASSINFILES .spamassassin > /dev/null 2>&1
if [ "$includemaildirs" == "n" ]; then
exclude="--exclude Maildir"
else
exclude=""
fi
#echo "Backing up vpopmail domains"
tar -C /home/vpopmail \
-cjf $backupdest/$VPOPMAIL domains > /dev/null 2>&1
#echo "Backing up MYSQL Data"
if [ $mysql_port == "0" ]; then
mysql_portparm=""
else
mysql_portparm="-P $mysql_port"
fi
mysqldump -u $mysql_user \
-p$mysql_password \
-h $mysql_host \
$mysql_portparm \
$mysql_database \
> $backupdest/$DATABASE
gzip $backupdest/$DATABASE 2>&1
#echo "Putting all backup files into one large archive"
tar --create \
--gzip \
--file $backupdest/$curlfile \
--directory $backupdest \
$QMAILCONTROL \
$SQMAILPREFS \
$SQMAILPLUGS \
$QMAILADMINPASSWD \
$SPAMASSASSINFILES \
$VPOPMAIL \
$gzmysqldata \
> /dev/null 2>&1
rm -rf \
$backupdest\$QMAILCONTROL \
$backupdest\$SQMAILPREFS \
$backupdest\$SQMAILPLUGS \
$backupdest\$QMAILADMINPASSWD \
$backupdest\$SPAMASSASSINFILES \
$backupdest\$VPOPMAIL \
$backupdest\$gzmysqldata \
endtime=`date +%a-%D-@-%X-%Z`
if [ $emailinfo = y ] ; then
echo "$me $myver" >/tmp/emailmsg.txt
echo "The Toaster Backup has Run. Please verify that it did it
correctly." >> /tmp/emailmsg.txt
echo " " >> /tmp/emailmsg.txt
echo " $me $myver" >> /tmp/emailmsg.txt
echo " " >> /tmp/emailmsg.txt
echo "Backup Start Time: $starttime" >> /tmp/emailmsg.txt
echo " " >> /tmp/emailmsg.txt
echo "Backup End Time: $endtime" >> /tmp/emailmsg.txt
echo " " >> /tmp/emailmsg.txt
echo "Backup Contents: " >> /tmp/emailmsg.txt
tar -tzvf $backupdest/$curlfile >> /tmp/emailmsg.txt
echo " " >> /tmp/emailmsg.txt
echo "ls -lh command on $backupdest" >> /tmp/emailmsg.txt
echo " " >> /tmp/emailmsg.txt
ls -lh $backupdest >> /tmp/emailmsg.txt
cat /tmp/emailmsg.txt | mail -s"Toaster Backup Executed $endtime" $email
rm -f /tmp/emailmsg.txt
fi
if [ $useftp = y ] ; then
curl -T $backupdest/$curlfile $ftpserver/$curlfile
echo " Backup has been uploaded to the FTP Server and"
echo " is also located in: $backupdest"
else
echo " Backup is complete and located in: $backupdest"
fi
exit 0
On Thu, Jan 22, 2015 at 10:04 PM, Eric Broch <[email protected]>
wrote:
> Can you post the script?
>
>
>
> On 1/22/2015 2:19 AM, Chandran Manikandan wrote:
>
> Hi All,
>
> I have run Qmailtoaster on Centos 6.6.
>
> I did qt-backup script and result come below. Here it's came all backup
> with individual zip file and consolidated to one backup file. So how to
> avoid this . I was used on Centos 5.5 qtp-backup and got Backup.tar.gz
> file only but this new script come with two times. Could anyone help me .
>
> Please see the attachment of my backup files.
>
> --
> *Thanks,*
> *Manikandan.C*
> *System Administrator*
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
--
*Thanks,*
*Manikandan.C*
*System Administrator*