Improve op_del improvement

This commit is contained in:
William Hirigoyen 2023-11-10 11:11:52 +01:00
parent f5fe462248
commit 8e15676d05

View file

@ -766,7 +766,9 @@ op_del() {
# Deactivate web vhost (apache or nginx)
if [ "$WEB_SERVER" == "apache" ]; then
a2dissite "${login}.conf" || true
if a2query -s test12 >/dev/null 2&>1; then
a2dissite "${login}.conf"
fi
rm -f /etc/apache2/sites-available/"$login.conf"
apache2ctl configtest
@ -809,18 +811,22 @@ op_del() {
if [ "$WEB_SERVER" == "apache" ]; then
if id www-"$login" &> /dev/null; then
userdel -f www-"$login" || true
userdel -f www-"$login"
fi
for php_version in "${PHP_VERSIONS[@]}"; do
if lxc-attach -n php"${php_version}" -- id www-"$login" &> /dev/null; then
lxc-attach -n php"${php_version}" -- userdel -f www-"$login" || true
if lxc-attach -n php"${php_version}" -- getent passwd www-"$login" &> /dev/null; then
lxc-attach -n php"${php_version}" -- userdel -f www-"$login"
fi
if lxc-attach -n php"${php_version}" -- getent passwd "$login" &> /dev/null; then
lxc-attach -n php"${php_version}" -- userdel -f "$login"
fi
lxc-attach -n php"${php_version}" -- userdel -f "$login" || true
done
fi
userdel -f "$login" || true
if getent passwd "$login" &> /dev/null; then
userdel -f "$login"
fi
sed -i.bak "/^$login:/d" /etc/aliases
if [ "$WEB_SERVER" == "apache" ]; then