Задать вопрос
@ToPneDoll

Lvm_backup_zimbra?

Здравствуйте, проблема в скрипте бекапа лвм зимбры, (взят с офф. сайта), укажите плз на ошибку

#!/bin/bash

time='date +%Y-%m-%d_%H-%M-%S'

# Modify the following variables according to your installation
#########################################

# backup_dir - directory to backup to
backup_dir=/zmbackup/lvm/$time

# zimbra_vol - the Logical Volume that contains /opt/zimbra
zimbra_vol=zimbra-zimbra

# vol_group - the Volume Group that contains $zimbra_vol
vol_group=mapper

# zimbra_vol_fs - the file system type (ext3, xfs, ...) in /opt/zimbra
zimbra_vol_fs=xfs

# lvcreate and lvremove commands path -
lvcreate_cmd='which lvcreate'
lvremove_cmd='which lvremove'

# Do not change anything beyond this point
#########################################

# Test for an interactive shell
if [[ $- != *i* ]]
then say() { echo -e $1; }
# Colors, yo!
GREEN="\e[1;32m"
RED="\e[1;31m"
CYAN="\e[1;36m"
PURPLE="\e[1;35m"
else say() { true; } # Do nothing
fi

# Output date
say $GREEN"Backup started at "$RED"'date'"$GREEN"."

# Stop the Zimbra services
say $CYAN"Stopping the Zimbra services..."
say $PURPLE" This may take several minutes."
/etc/init.d/zimbra stop

# Create a logical volume called ZimbraBackup
say $GREEN"Creating a LV called ZimbraBackup:"$PURPLE
$lvcreate_cmd -L 10G -s -n ZimbraBackup /dev/$vol_group/$zimbra_vol

# Create a mountpoint to mount the logical volume to
say $GREEN"Creating a mountpoint for the LV..."
# WARNING: this is insecure!
mkdir -p /tmp/ZimbraBackup

# Mount the logical volume to the mountpoint
say $GREEN"Mounting the LV..."
# WARNING: remove nouuid option if the filesystem is not formatted as XFS !!!
mount -t $zimbra_vol_fs -o nouuid,ro /dev/$vol_group/ZimbraBackup /tmp/ZimbraBackup/

# Start the Zimbra services
say $CYAN"Starting the Zimbra services..."
# WARNING: it's safer not to put this command in background
/etc/init.d/zimbra start &

# For testing only
#say $RED"Press Enter to continue...\e[0m"
#read input

# Create the current backup
say $GREEN"Creating the backup directory and backup..."
mkdir -p $backup_dir
tar zcvf $backup_dir/zimbra.backup.tar.gz /tmp/ZimbraBackup/zimbra/ 2&> /dev/null

# Unmount /tmp/ZimbraBackup and remove the logical volume
say $GREEN"Unmounting and removing the LV."$PURPLE
umount /tmp/ZimbraBackup/
$lvremove_cmd --force /dev/$vol_group/ZimbraBackup

# Done!
say $GREEN"Zimbra backed up to "$CYAN$backup_dir$GREEN"!"
say $GREEN"Backup ended at "$RED"'date'"$GREEN".\e[0m"

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/cl-root 101G 4.0G 97G 4% /
devtmpfs 71G 0 71G 0% /dev
tmpfs 71G 0 71G 0% /dev/shm
tmpfs 71G 4.1G 67G 6% /run
tmpfs 71G 0 71G 0% /sys/fs/cgroup
/dev/sda1 1014M 228M 787M 23% /boot
/dev/mapper/zimbra-zimbra 477G 201G 276G 43% /opt/zimbra
/dev/mapper/zmbackup-zmbackup 466G 155G 312G 34% /zmbackup
tmpfs 15G 0 15G 0% /run/user/1003

/dev/sda1 xfs 1038336 232492 805844 23% /boot
/dev/mapper/zimbra-zimbra xfs 499824180 210692452 289131728 43% /opt/zimbra
/dev/mapper/zmbackup-zmbackup xfs 488103056 161823512 326279544 34% /zmbackup

Backup started at 'date'.
Stopping the Zimbra services...
This may take several minutes.
Host mail.mail.ru
Stopping zmconfigd...Done.
Stopping zimlet webapp...Done.
Stopping zimbraAdmin webapp...Done.
Stopping zimbra webapp...Done.
Stopping service webapp...Done.
Stopping stats...Done.
Stopping mta...Done.
Stopping spell...Done.
Stopping snmp...Done.
Stopping cbpolicyd...Done.
Stopping archiving...Done.
Stopping opendkim...Done.
Stopping amavis...Done.
Stopping antivirus...Done.
Stopping antispam...Done.
Stopping proxy...Done.
Stopping memcached...Done.
Stopping mailbox...Done.
Stopping logger...Done.
Stopping dnscache...Done.
Stopping ldap...Done.
Creating a LV called ZimbraBackup:
which: invalid option -- 'L'
which: invalid option -- 's'
which: invalid option -- 'n'
/usr/sbin/lvcreate
which: no 100G in (/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/rl/.local/bin:/home/rl/bin)
which: no ZimbraBackup in (/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/rl/.local/bin:/home/rl/bin)
which: no zimbra-zimbra in (/dev/mapper)
Creating a mountpoint for the LV...
Mounting the LV...
mount: special device /dev/mapper/ZimbraBackup does not exist
Starting the Zimbra services...
Creating the backup directory and backup...
Unmounting and removing the LV.
umount: /tmp/ZimbraBackup/: not mounted
which: unrecognized option '--force'
/usr/sbin/lvremove
which: no ZimbraBackup in (/dev/mapper)
Zimbra backed up to /zmbackup/lvm/date
Backup ended at 'date'.
[root@mail2 run]# Host mail.mail.ru
Starting ldap...Done.
Starting zmconfigd...Done.
Starting logger...Done.
Starting mailbox...Done.
Starting memcached...Done.
Starting proxy...Done.
Starting amavis...Done.
Starting antispam...Done.
Starting antivirus...Done.
Starting opendkim...Done.
Starting snmp...Done.
Starting spell...Done.
Starting mta...Done.
Starting stats...Done.
Starting service webapp...Done.
Starting zimbra webapp...Done.
Starting zimbraAdmin webapp...Done.
Starting zimlet webapp...Done.
  • Вопрос задан
  • 85 просмотров
Подписаться 1 Простой Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы