minor code cleanup

This commit is contained in:
Matthew Saunders Brown 2021-02-11 16:20:40 -08:00
parent bd12a4ee26
commit 3204bf3500

View File

@ -17,10 +17,31 @@ help()
echo ""
echo " -h Print this help."
echo " -q QUOTA Set mailbox quota in GB, otherwise default for this domain is used. NULL means no limit."
echo " -s STATUS 1 for enabled, 0 for disabled."
echo " -s STATUS 1 for enabled, 0 for disabled. Default is in db structure and is normally set to 1."
exit
}
# set any options that were passed
while getopts "hq:s:" opt; do
case "${opt}" in
h )
help
exit;;
q )
quota=${OPTARG}
;;
s )
status=${OPTARG}
;;
\? )
echo "Invalid option: $OPTARG" 1>&2
exit;;
: )
echo "Invalid option: $OPTARG requires an argument" 1>&2
exit;;
esac
done
# check for and set email address, local part & domain, password
if [ -n "$2" ]; then
if [ $1 == "-h" ] || [ $2 == "-h" ]; then
@ -52,27 +73,6 @@ else
help
fi
# set any options that were passed
while getopts "hq:s:" opt; do
case "${opt}" in
h )
help
exit;;
q )
quota=${OPTARG}
;;
s )
status=${OPTARG}
;;
\? )
echo "Invalid option: $OPTARG" 1>&2
exit;;
: )
echo "Invalid option: $OPTARG requires an argument" 1>&2
exit;;
esac
done
# get domain_id (and thus check if domain already exists)
domain_id=`mysql --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE -s -r -N -e "SELECT id from vm_domains WHERE domain='$domain';"`
if [ -z $domain_id ] ; then