1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pixelfed_ynh.git synced 2024-09-03 20:06:04 +02:00

improving service management

This commit is contained in:
yalh76 2020-06-05 01:41:07 +02:00
parent cd8518e8c2
commit e9d8804997
7 changed files with 16 additions and 15 deletions

View file

@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
true
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors

View file

@ -125,7 +125,7 @@ popd
#=================================================
ynh_script_progression --message="Starting a supervisor service..."
ynh_supervisor_action --service_name="${app}-horizon" --action="start" --log_path="/var/log/$app/${app}-horizon.log"
ynh_supervisor_action --service_name="${app}-horizon" --action="start" --log_path="systemd" --line_match="success: ${app}-horizon"
#=================================================
# RELOAD NGINX

View file

@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
true
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -120,7 +120,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
ynh_script_progression --message="Installing composer dependencies..."
ynh_install_composer --phpversion="$phpversion" --workdir="$final_path"
ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$final_path"
#=================================================
# CREATE LOG FILE
@ -223,7 +223,7 @@ yunohost service add "supervisor" --description "Supervisor daemon for $app" --l
ynh_script_progression --message="Starting a supervisor service..."
# Start a supervisor service
ynh_supervisor_action --service_name="${app}-horizon" --action="start" --log_path="/var/log/$app/${app}-horizon.log" --line_match="Horizon started successfully"
ynh_supervisor_action --service_name="${app}-horizon" --action="reload" --log_path="systemd" --line_match="success: ${app}-horizon"
#=================================================
# SETUP SSOWAT

View file

@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
true
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -137,7 +137,7 @@ yunohost service add "supervisor" --description "Supervisor daemon for $app" --l
#=================================================
ynh_script_progression --message="Starting a supervisor service..."
ynh_supervisor_action --service_name="${app}-horizon" --action="start" --log_path="/var/log/$app/${app}-horizon.log"
ynh_supervisor_action --service_name="${app}-horizon" --action="reload" --log_path="systemd" --line_match="success: ${app}-horizon"
#=================================================
# RESTORE THE CRON FILE

View file

@ -70,6 +70,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
@ -115,7 +116,7 @@ if dpkg --compare-versions "0.10.9~ynh2" gt "$(ynh_read_manifest --manifest="/et
ynh_add_supervisor_config --service="${app}-horizon" --template=horizon.conf --others_var="phpversion"
ynh_script_progression --message="Starting a supervisor service..."
ynh_supervisor_action --service_name="${app}-horizon" --action="start" --log_path="/var/log/$app/${app}-horizon.log"
ynh_supervisor_action --service_name="${app}-horizon" --action="start" --log_path="systemd" --line_match="success: ${app}-horizon"
fi
if dpkg --compare-versions "0.10.9~ynh3" gt "$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version" || echo 1.0)" ; then
@ -138,7 +139,7 @@ fi
#=================================================
ynh_script_progression --message="Stopping a supervisor service..."
ynh_supervisor_action --service_name="${app}-horizon" --action="stop" --log_path="/var/log/$app/${app}-horizon.log"
ynh_supervisor_action --service_name="${app}-horizon" --action="stop" --log_path="systemd" --line_match="stopped: ${app}-horizon"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -193,7 +194,7 @@ ynh_script_progression --message="Updating php dependencies..."
chown -R "$app": "$final_path"
ynh_composer_exec --phpversion="$phpversion" --workdir="$final_path" --commands="update"
ynh_exec_warn_less ynh_composer_exec --phpversion="$phpversion" --workdir="$final_path" --commands="update"
#=================================================
# MODIFY A CONFIG FILE
@ -296,7 +297,7 @@ fi
#=================================================
ynh_script_progression --message="Starting a supervisor service..."
ynh_supervisor_action --service_name="${app}-horizon" --action="start" --log_path="/var/log/$app/${app}-horizon.log"
ynh_supervisor_action --service_name="${app}-horizon" --action="start" --log_path="systemd" --line_match="success: ${app}-horizon"
#=================================================
# RELOAD NGINX

View file

@ -20,7 +20,7 @@ ynh_composer_exec () {
COMPOSER_HOME="$workdir/.composer" \
php${phpversion} "$workdir/composer.phar" $commands \
-d "$workdir" --quiet --no-interaction
-d "$workdir" --no-interaction
}
# Install and initialize Composer in the given directory
@ -44,7 +44,7 @@ ynh_install_composer () {
curl -sS https://getcomposer.org/installer \
| COMPOSER_HOME="$workdir/.composer" \
php${phpversion} -- --quiet --install-dir="$workdir" \
php${phpversion} -- --install-dir="$workdir" \
|| ynh_die "Unable to install Composer."
# update dependencies to create composer.lock

View file

@ -118,9 +118,9 @@ ynh_supervisor_action() {
then
local templog="$(mktemp)"
# Following the starting of the app in its log
if [ "$log_path" == "supervisor" ] ; then
if [ "$log_path" == "systemd" ] ; then
# Read the supervisor journal
journalctl --unit=$service_name --follow --since=-0 --quiet > "$templog" &
journalctl --unit=supervisor --follow --since=-0 --quiet > "$templog" &
# Get the PID of the journalctl command
local pid_tail=$!
else