Skip to content
Snippets Groups Projects
Commit 784cee0e authored by Bob Mottram's avatar Bob Mottram
Browse files

Stop and restart the mail server when backing up

Otherwise mail can arrive during the process
parent 282594eb
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment