updated sudo commands
This commit is contained in:
parent
c121d48f74
commit
ecef7dee1c
28
bin/vmail.sh
28
bin/vmail.sh
@ -6,19 +6,29 @@
|
||||
#
|
||||
# vmail include file, used by other vmail bash scripts
|
||||
|
||||
# any script that includes this conf file will force user to be vmail
|
||||
if [ "$USER" != "vmail" ]; then
|
||||
exec sudo -u vmail --shell /bin/bash $0 $@
|
||||
fi
|
||||
|
||||
# constants
|
||||
readonly VMAIL_DIR=/var/vmail
|
||||
readonly MYSQL_CONNECTION_INFO_FILE=$VMAIL_DIR/.my.cnf
|
||||
|
||||
# check that MYSQL_CONNECTION_INFO_FILE exists and is readable
|
||||
if [ ! -f "$MYSQL_CONNECTION_INFO_FILE" ]; then
|
||||
echo "ERROR: MySQL connection info file ($MYSQL_CONNECTION_INFO_FILE) does not exist or is not readable."
|
||||
exit
|
||||
# switch to required user
|
||||
if [[ $(basename $0) == "vmail-dkim-"* ]]; then
|
||||
if [[ "$USER" != "Debian-exim" ]]; then
|
||||
exec sudo -u Debian-exim -g ssl-cert --shell /bin/bash $0 $@
|
||||
fi
|
||||
elif [[ $(basename $0) == "vmail-purge-spool.sh" ]]; then
|
||||
if [[ "$USER" != "Debian-exim" ]]; then
|
||||
exec sudo -u Debian-exim --shell /bin/bash $0 $@
|
||||
fi
|
||||
else
|
||||
if [[ "$USER" != "vmail" ]]; then
|
||||
exec sudo -u vmail --shell /bin/bash $0 $@
|
||||
else
|
||||
# check that MYSQL_CONNECTION_INFO_FILE exists and is readable
|
||||
if [ ! -f "$MYSQL_CONNECTION_INFO_FILE" ]; then
|
||||
echo "ERROR: MySQL connection info file ($MYSQL_CONNECTION_INFO_FILE) does not exist or is not readable."
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# functions
|
||||
|
Loading…
x
Reference in New Issue
Block a user