new archive script
This commit is contained in:
parent
5bfce22f55
commit
d6f35d6f78
45
bin/vmail-domains-arc.sh
Executable file
45
bin/vmail-domains-arc.sh
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# vmail-stack
|
||||
# https://git.stack-source.com/msb/vmail-stack
|
||||
# Copyright (c) 2023 Matthew Saunders Brown <matthewsaundersbrown@gmail.com>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
# load include file
|
||||
source $(dirname $0)/vmail.sh
|
||||
|
||||
help()
|
||||
{
|
||||
thisfilename=$(basename -- "$0")
|
||||
echo "Create archive of vmail domain on this server. Includes emails and all email settings."
|
||||
echo ""
|
||||
echo "usage: $thisfilename -d <domain> [OPTIONS]"
|
||||
echo ""
|
||||
echo " -h Print this help."
|
||||
echo " -d <domain> Domain name of vmail domain to create archive for."
|
||||
exit
|
||||
}
|
||||
|
||||
vmail:getoptions "$@"
|
||||
|
||||
# check for domain
|
||||
if [[ -z $domain ]]; then
|
||||
echo "domain is required"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ ! -d /var/vmail/$domain ]]; then
|
||||
echo "vmail for $domain does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# create export of vmail settings
|
||||
/usr/local/bin/vmail-domains-exp.sh -d $domain
|
||||
|
||||
# make sure archive dir exists
|
||||
if [[ ! -d /opt/archives ]]; then
|
||||
mkdir /opt/archives
|
||||
fi
|
||||
|
||||
# create tarball
|
||||
tar --directory=/var/vmail/ -czf /opt/archives/mail.$domain.tar.gz $domain
|
Loading…
Reference in New Issue
Block a user