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
|
||||
if [ -d /home/$USERNAME/Maildir ]; then
|
||||
echo $"Stopping mail server"
|
||||
systemctl stop exim4
|
||||
echo $"Creating an email archive for $USERNAME"
|
||||
if [ ! -d /root/tempbackupemail/$USERNAME ]; then
|
||||
mkdir -p /root/tempbackupemail/$USERNAME
|
||||
fi
|
||||
tar -czvf /root/tempbackupemail/$USERNAME/maildir.tar.gz /home/$USERNAME/Maildir
|
||||
echo $"Restarting mail server"
|
||||
systemctl start exim4
|
||||
echo $"Backing up emails for $USERNAME"
|
||||
backup_directory_to_usb /root/tempbackupemail/$USERNAME mail/$USERNAME
|
||||
fi
|
||||
|
|
|
@ -283,11 +283,15 @@ function backup_users {
|
|||
|
||||
# email
|
||||
if [ -d /home/$USERNAME/Maildir ]; then
|
||||
echo $"Stopping mail server"
|
||||
systemctl stop exim4
|
||||
echo $"Creating an email archive"
|
||||
if [ ! -d /root/backupemail/$USERNAME ]; then
|
||||
mkdir -p /root/backupemail/$USERNAME
|
||||
fi
|
||||
tar -czvf /root/backupemail/$USERNAME/maildir.tar.gz /home/$USERNAME/Maildir
|
||||
echo $"Restarting mail server"
|
||||
systemctl start exim4
|
||||
echo $"Backing up emails for $USERNAME"
|
||||
backup_directory_to_friend /root/backupemail/$USERNAME mail/$USERNAME
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue