From 7d745505667b4263889af7acea2467a550f1b7a0 Mon Sep 17 00:00:00 2001 From: Fabian Wilkens Date: Fri, 12 Aug 2022 16:53:32 +0200 Subject: [PATCH] Fix: scripts --- scripts/_common.sh | 6 ++++++ scripts/remove | 2 ++ scripts/restore | 4 ++-- scripts/upgrade | 4 +++- sources/extra_files/cron.sh | 2 +- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 5023f2d..edcbb3b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -15,6 +15,12 @@ pkg_dependencies="" # PERSONAL HELPERS #================================================= + +# Reset failed systemd services. +ynh_reset_systemd(){ + systemctl reset-failed +} + # Substitute/replace a string (or expression) by another in a file on a # # usage: ynh_replace_string_occurrence --occurrence=occurrence --match_string=match_string --replace_string=replace_string --target_file=target_file diff --git a/scripts/remove b/scripts/remove index 969a31c..1b7c9f5 100755 --- a/scripts/remove +++ b/scripts/remove @@ -82,6 +82,8 @@ ynh_remove_systemd_config --service="$app-files" ynh_remove_systemd_config --service="$app-syncing-server" ynh_remove_systemd_config --service="$app-syncing-server-worker" +ynh_reset_systemd + #================================================= # REMOVE THE MYSQL DATABASE #================================================= diff --git a/scripts/restore b/scripts/restore index 4522096..7182150 100755 --- a/scripts/restore +++ b/scripts/restore @@ -180,10 +180,10 @@ ynh_replace_string --match_string="^AUTH_SERVER_URL.*$" --replace_string="AUTH_S ynh_replace_string --match_string="^PORT.*$" --replace_string="PORT=$port_auth_worker" --target_file="$config_auth_worker" # API-Gateway Port ynh_replace_string --match_string="^PORT.*$" --replace_string="PORT=$port_api_gateway" --target_file="$config_api_gateway" -ynh_replace_string_occurrence --occurrence="1" --match_string="^proxy_pass.*$" --replace_string="proxy_pass http://127.0.0.1:$port_api_gateway/;" --target_file="$config_nginx" +ynh_replace_string_occurrence --occurrence="1" --match_string="proxy_pass.*$" --replace_string="proxy_pass http://127.0.0.1:$port_api_gateway/;" --target_file="$config_nginx" # Files Port ynh_replace_string --match_string="^PORT.*$" --replace_string="PORT=$port_files" --target_file="$config_files" -ynh_replace_string_occurrence --occurrence="2" --match_string="^proxy_pass.*$" --replace_string="proxy_pass http://127.0.0.1:$port_files/;" --target_file="$config_nginx" +ynh_replace_string_occurrence --occurrence="2" --match_string="proxy_pass.*$" --replace_string="proxy_pass http://127.0.0.1:$port_files/;" --target_file="$config_nginx" #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index 17be4a3..ad9d81f 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -230,12 +230,14 @@ then ynh_script_progression --message="Removing old service..." --weight=1 yunohost service remove "$app-syncing-server-js" ynh_remove_systemd_config --service="$app-syncing-server-js" + ynh_reset_systemd fi if ynh_exec_warn_less yunohost service status "$app-syncing-server-js-worker" >/dev/null then ynh_script_progression --message="Removing old service..." --weight=1 yunohost service remove "$app-syncing-server-js-worker" - ynh_remove_systemd_config --service="$app-syncing-server-worker-js" + ynh_remove_systemd_config --service="$app-syncing-server-js-worker" + ynh_reset_systemd fi # Remove unneeded data diff --git a/sources/extra_files/cron.sh b/sources/extra_files/cron.sh index 2e5f2be..5be7ea4 100755 --- a/sources/extra_files/cron.sh +++ b/sources/extra_files/cron.sh @@ -2,7 +2,7 @@ if [ ! -f .env ] then - export $(cat cron.env | xargs) + export $(cat cron.env | grep -v -E "^#" | xargs) fi FILE_UPLOAD_BYTES_PER_MB=1048576