Stop and restart the mail server when backing up
Otherwise mail can arrive during the process
This commit is contained in:
parent
282594eb09
commit
784cee0eda
|
@ -356,11 +356,15 @@ function backup_users {
|
||||||
|
|
||||||
# Backup email
|
# Backup email
|
||||||
if [ -d /home/$USERNAME/Maildir ]; then
|
if [ -d /home/$USERNAME/Maildir ]; then
|
||||||
|
echo $"Stopping mail server"
|
||||||
|
systemctl stop exim4
|
||||||
echo $"Creating an email archive for $USERNAME"
|
echo $"Creating an email archive for $USERNAME"
|
||||||
if [ ! -d /root/tempbackupemail/$USERNAME ]; then
|
if [ ! -d /root/tempbackupemail/$USERNAME ]; then
|
||||||
mkdir -p /root/tempbackupemail/$USERNAME
|
mkdir -p /root/tempbackupemail/$USERNAME
|
||||||
fi
|
fi
|
||||||
tar -czvf /root/tempbackupemail/$USERNAME/maildir.tar.gz /home/$USERNAME/Maildir
|
tar -czvf /root/tempbackupemail/$USERNAME/maildir.tar.gz /home/$USERNAME/Maildir
|
||||||
|
echo $"Restarting mail server"
|
||||||
|
systemctl start exim4
|
||||||
echo $"Backing up emails for $USERNAME"
|
echo $"Backing up emails for $USERNAME"
|
||||||
backup_directory_to_usb /root/tempbackupemail/$USERNAME mail/$USERNAME
|
backup_directory_to_usb /root/tempbackupemail/$USERNAME mail/$USERNAME
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -283,11 +283,15 @@ function backup_users {
|
||||||
|
|
||||||
# email
|
# email
|
||||||
if [ -d /home/$USERNAME/Maildir ]; then
|
if [ -d /home/$USERNAME/Maildir ]; then
|
||||||
|
echo $"Stopping mail server"
|
||||||
|
systemctl stop exim4
|
||||||
echo $"Creating an email archive"
|
echo $"Creating an email archive"
|
||||||
if [ ! -d /root/backupemail/$USERNAME ]; then
|
if [ ! -d /root/backupemail/$USERNAME ]; then
|
||||||
mkdir -p /root/backupemail/$USERNAME
|
mkdir -p /root/backupemail/$USERNAME
|
||||||
fi
|
fi
|
||||||
tar -czvf /root/backupemail/$USERNAME/maildir.tar.gz /home/$USERNAME/Maildir
|
tar -czvf /root/backupemail/$USERNAME/maildir.tar.gz /home/$USERNAME/Maildir
|
||||||
|
echo $"Restarting mail server"
|
||||||
|
systemctl start exim4
|
||||||
echo $"Backing up emails for $USERNAME"
|
echo $"Backing up emails for $USERNAME"
|
||||||
backup_directory_to_friend /root/backupemail/$USERNAME mail/$USERNAME
|
backup_directory_to_friend /root/backupemail/$USERNAME mail/$USERNAME
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue