update script names that run as root

This commit is contained in:
Matthew Saunders Brown 2024-11-22 11:18:28 -08:00
parent 2bf4ce46c1
commit 0d45ff6e60

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-arc.sh" ]] || [[ $(basename $0) == "vmail-domains-del.sh" ]] || [[ $(basename $0) == "vmail-domains-exp.sh" ]] || [[ $(basename $0) == "vmail-domains-imp.sh" ]] || [[ $(basename $0) == "vmail-dovecot-"* ]]; then
if [[ $(basename $0) == "vmail-domains-*" ]] || [[ $(basename $0) == "vmail-dovecot-"* ]] || [[ $(basename $0) == "vmail-webmail-"* ]]; then
if [[ "$USER" != "root" ]]; then
exec sudo -u root $0 "$@"
fi