From 18cb5fe0ea4f971f21e4cdedd1db0b0ed573aae2 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 31 May 2019 18:37:48 +0200 Subject: [PATCH] fix service --- conf/horizon.service | 2 +- scripts/backup | 4 ++-- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 9 +++++++-- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/conf/horizon.service b/conf/horizon.service index bd630724..61da93a4 100644 --- a/conf/horizon.service +++ b/conf/horizon.service @@ -7,7 +7,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__/ -ExecStart=/usr/bin/php7.2 __FINALPATH__/artisan horizon >> /var/log/__APP__/__APP__-horizon.log 2>&1 +ExecStart=/usr/bin/php7.2 __FINALPATH__/artisan horizon Restart=on-failure [Install] diff --git a/scripts/backup b/scripts/backup index e01ad177..e2e62033 100644 --- a/scripts/backup +++ b/scripts/backup @@ -35,7 +35,7 @@ db_name=$(ynh_app_setting_get --app="$app" --key=db_name) #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name="${app}-horizon" --action="stop" --log_path="/var/log/$app/${app}-horizon.log" +ynh_systemd_action --service_name="${app}-horizon" --action="stop" --log_path=systemd #================================================= # BACKUP THE APP MAIN DIR @@ -79,7 +79,7 @@ ynh_backup --src_path="/etc/systemd/system/${app}-horizon.service" #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name="${app}-horizon" --action="start" --log_path="/var/log/$app/${app}-horizon.log" +ynh_systemd_action --service_name="${app}-horizon" --action="start" --log_path=systemd #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 0e6d31d5..8a234fa2 100644 --- a/scripts/install +++ b/scripts/install @@ -189,7 +189,7 @@ yunohost service add "${app}-horizon" --description "${app}-horizon daemon for $ ynh_print_info --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name="${app}-horizon" --action="start" --log_path="/var/log/$app/${app}-horizon.log" +ynh_systemd_action --service_name="${app}-horizon" --action="start" --log_path=systemd #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index c0d739aa..87f941ae 100644 --- a/scripts/restore +++ b/scripts/restore @@ -122,7 +122,7 @@ yunohost service add "${app}-horizon" --log "/var/log/$app/${app}-horizon.log" #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name="${app}-horizon" --action="start" --log_path="/var/log/$app/${app}-horizon.log" +ynh_systemd_action --service_name="${app}-horizon" --action="start" --log_path=systemd #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 9ca2a713..2cd21207 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -65,6 +65,10 @@ if [ -z "$app_key" ]; then ynh_app_setting_set --app="$app" --key=app_key --value="$app_key" fi +if dpkg --compare-versions "0.9.0~ynh3" gt "$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version" || echo 1.0)" ; then + ynh_add_systemd_config --service="${app}-horizon" --template=horizon.service +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -73,6 +77,7 @@ ynh_print_info --message="Backing up the app before upgrading (may take a while) # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { + read -p "key" # restore it if the upgrade fails ynh_restore_upgradebackup } @@ -86,7 +91,7 @@ ynh_abort_if_errors #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name="${app}-horizon" --action="stop" --log_path="/var/log/$app/${app}-horizon.log" +ynh_systemd_action --service_name="${app}-horizon" --action="stop" --log_path=systemd #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -227,7 +232,7 @@ fi #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name="${app}-horizon" --action="start" --log_path="/var/log/$app/${app}-horizon.log" +ynh_systemd_action --service_name="${app}-horizon" --action="start" --log_path=systemd #================================================= # RELOAD NGINX