From d27171a82abed6f2f6141c4c7160154ebe2febdf Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Wed, 8 Feb 2017 11:03:00 +0100 Subject: [PATCH] [fix] Reload nginx just after removing nginx conf --- scripts/remove | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/remove b/scripts/remove index 1d8df2c..4e1c915 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,14 +10,19 @@ source /usr/share/yunohost/helpers domain=$(ynh_app_setting_get "$app" domain) # Remove sources -if test -z "$app" || [ "$app" = "/" ]; then - echo "Variable app is empty, suppression of app directory cancelled." >&2 +# Avoid removing important directory if $app is empty or equal to +# "/" "/var" "/var/www" "/opt" "/home" "/home/yunohost.app" +src_path=/var/www/$app +if test -z "$src_path" || [ "/var/www /opt /home/yunohost.app" =~ $src_path ]; then + echo "Variable src_path seems incomplete, suppression of app directory cancelled." >&2 else - sudo rm -rf /var/www/$app + sudo rm -rf $src_path fi # Remove nginx configuration file sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf +# Reload nginx service +sudo service nginx reload ### PHP (remove if not used) ### # If a dedicated php-fpm process is used: @@ -34,5 +39,3 @@ sudo service php5-fpm reload # ynh_mysql_drop_user "$dbuser" || true ### MySQL end ### -# Reload nginx service -sudo service nginx reload