From 197f9369f4e4d792078a294b2280b75ecb990c1d Mon Sep 17 00:00:00 2001 From: Moul Date: Fri, 31 Mar 2017 11:33:59 +0200 Subject: [PATCH 1/2] [mod] move as a f() daemon stop and debian pkg removal. --- scripts/functions.sh | 9 +++++++++ scripts/remove | 4 +--- scripts/upgrade | 7 +------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index 0c862d2..eaeda40 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -45,3 +45,12 @@ sudo sed -i "s@YNH_EXAMPLE_DOMAIN@$domain@" $nginx_conf sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf sudo service nginx reload } + + +REMOVE_DUNITER () { +# Stop duniter daemon +sudo duniter stop + +# Remove Duniter package +sudo dpkg -r duniter +} diff --git a/scripts/remove b/scripts/remove index 289040c..69240ce 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,9 +10,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) port=$(ynh_app_setting_get $app port) -# Remove Duniter -sudo duniter stop -sudo dpkg -r duniter +REMOVE_DUNITER # Remove data and conf sudo rm -rf /root/.conf/duniter diff --git a/scripts/upgrade b/scripts/upgrade index bc542a1..cc74fcc 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,12 +15,7 @@ arch=$(ynh_app_setting_get "$app" arch) admin=$(ynh_app_setting_get "$app" admin) is_cesium_public=$(ynh_app_setting_get "$app" is_cesium_public) -# Stop duniter daemon -sudo duniter stop - -# Remove Duniter package -sudo dpkg -r duniter - +REMOVE_DUNITER INSTALL_DUNITER_DEBIAN_PACKAGE # Start duniter daemon From 2d4040a9cf2a9fd2d0dc0bc7cf1b429ea1cae05a Mon Sep 17 00:00:00 2001 From: Moul Date: Fri, 31 Mar 2017 11:36:28 +0200 Subject: [PATCH 2/2] [fix] #21: stop daemon only when running. --- scripts/functions.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index eaeda40..9dd401b 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -46,10 +46,12 @@ sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf sudo service nginx reload } - REMOVE_DUNITER () { -# Stop duniter daemon -sudo duniter stop +# Stop duniter daemon if running +sudo duniter status +if [ `echo "$?"` == 0 ]; then + sudo duniter stop +fi # Remove Duniter package sudo dpkg -r duniter