add verbose option to bin/vmail-domains-exp.sh

This commit is contained in:
Matthew Saunders Brown 2023-10-09 16:35:30 -07:00
parent d6f35d6f78
commit a88ef93d49
2 changed files with 15 additions and 9 deletions

View File

@ -14,10 +14,11 @@ help()
echo "$thisfilename"
echo "Export vmail settings, for backups and/or migrating to a new server."
echo ""
echo "usage: $thisfilename -d <domain>"
echo "usage: $thisfilename -d <domain> [-v] [-h]"
echo ""
echo " -h Print this help."
echo " -d Domain to export settings for."
echo " -v Verbose - output instructions for sycning vmail domain to new server, if verbose option was enabled."
exit
}
@ -93,6 +94,9 @@ if [[ "$domains_id" -gt '0' ]] ; then
/usr/local/bin/vmail-roundcubemail-settings-export.php $domain
fi
# output instructions for sycning website to new server, if verbose option was enabled.
if [[ -n $verbose ]]; then
servername=`hostname -f`
echo
@ -102,6 +106,8 @@ if [[ "$domains_id" -gt '0' ]] ; then
echo "rsync -v --archive --relative --rsh=/usr/bin/ssh root@$servername:/var/vmail/$domain /"
echo "vmail-domains-imp.sh -d $domain"
fi
else
echo "$domain exists in vmail db, but /var/vmail/$domain dir does not exist."

View File

@ -12,7 +12,7 @@ readonly VMAIL_DIR=/var/vmail
readonly MYSQL_CONNECTION_INFO_FILE=$VMAIL_DIR/.my.cnf
# switch to required user
if [[ $(basename $0) == "vmail-domains-exp.sh" ]] || [[ $(basename $0) == "vmail-domains-imp.sh" ]] || [[ $(basename $0) == "vmail-dovecot-"* ]]; then
if [[ $(basename $0) == "vmail-domains-arc.sh" ]] || [[ $(basename $0) == "vmail-domains-exp.sh" ]] || [[ $(basename $0) == "vmail-domains-imp.sh" ]] || [[ $(basename $0) == "vmail-dovecot-"* ]]; then
if [[ "$USER" != "root" ]]; then
exec sudo -u root $0 "$@"
fi