Prevent op_del to fail and able to remove web account when part of it is already removed
This commit is contained in:
parent
2e8619e5e6
commit
72e39f297e
|
@ -12,6 +12,8 @@ The **patch** part changes is incremented if multiple releases happen the same m
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
* Prevent op_del to fail and able to remove web account when part of it is already removed
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
* Add sendmail_path and open_basedir in LXC PHP pool configs
|
* Add sendmail_path and open_basedir in LXC PHP pool configs
|
||||||
|
|
|
@ -766,8 +766,8 @@ op_del() {
|
||||||
|
|
||||||
# Deactivate web vhost (apache or nginx)
|
# Deactivate web vhost (apache or nginx)
|
||||||
if [ "$WEB_SERVER" == "apache" ]; then
|
if [ "$WEB_SERVER" == "apache" ]; then
|
||||||
a2dissite "${login}.conf"
|
a2dissite "${login}.conf" || true
|
||||||
rm /etc/apache2/sites-available/"$login.conf"
|
rm -f /etc/apache2/sites-available/"$login.conf"
|
||||||
|
|
||||||
apache2ctl configtest
|
apache2ctl configtest
|
||||||
|
|
||||||
|
@ -794,33 +794,33 @@ op_del() {
|
||||||
phpfpm_dir="/etc/php5/fpm/pool.d/"
|
phpfpm_dir="/etc/php5/fpm/pool.d/"
|
||||||
initscript_path="/etc/init.d/php5-fpm"
|
initscript_path="/etc/init.d/php5-fpm"
|
||||||
fi
|
fi
|
||||||
rm /var/lib/lxc/php"${php_version}"/rootfs/${phpfpm_dir}/"${login}".conf
|
rm -f /var/lib/lxc/php"${php_version}"/rootfs/${phpfpm_dir}/"${login}".conf
|
||||||
lxc-attach -n php"${php_version}" -- $initscript_path restart >/dev/null
|
lxc-attach -n php"${php_version}" -- $initscript_path restart >/dev/null
|
||||||
done
|
done
|
||||||
|
|
||||||
elif [ "$WEB_SERVER" == "nginx" ]; then
|
elif [ "$WEB_SERVER" == "nginx" ]; then
|
||||||
rm /etc/nginx/sites-{available,enabled}/"$login"
|
rm -f /etc/nginx/sites-{available,enabled}/"$login"
|
||||||
rm /etc/munin/plugins/phpfpm_"${in_login}"*
|
rm -f /etc/munin/plugins/phpfpm_"${in_login}"*
|
||||||
nginx -t
|
nginx -t
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm /etc/awstats/awstats."$login.conf"
|
rm -f /etc/awstats/awstats."$login.conf"
|
||||||
sed -i.bak "/-config=$login /d" /etc/cron.d/awstats
|
sed -i.bak "/-config=$login /d" /etc/cron.d/awstats
|
||||||
|
|
||||||
if [ "$WEB_SERVER" == "apache" ]; then
|
if [ "$WEB_SERVER" == "apache" ]; then
|
||||||
if id www-"$login" &> /dev/null; then
|
if id www-"$login" &> /dev/null; then
|
||||||
userdel -f www-"$login"
|
userdel -f www-"$login" || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for php_version in "${PHP_VERSIONS[@]}"; do
|
for php_version in "${PHP_VERSIONS[@]}"; do
|
||||||
if lxc-attach -n php"${php_version}" -- id www-"$login" &> /dev/null; then
|
if lxc-attach -n php"${php_version}" -- id www-"$login" &> /dev/null; then
|
||||||
lxc-attach -n php"${php_version}" -- userdel -f www-"$login"
|
lxc-attach -n php"${php_version}" -- userdel -f www-"$login" || true
|
||||||
fi
|
fi
|
||||||
lxc-attach -n php"${php_version}" -- userdel -f "$login"
|
lxc-attach -n php"${php_version}" -- userdel -f "$login" || true
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
userdel -f "$login"
|
userdel -f "$login" || true
|
||||||
|
|
||||||
sed -i.bak "/^$login:/d" /etc/aliases
|
sed -i.bak "/^$login:/d" /etc/aliases
|
||||||
if [ "$WEB_SERVER" == "apache" ]; then
|
if [ "$WEB_SERVER" == "apache" ]; then
|
||||||
|
|
Loading…
Reference in a new issue