1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/fab-manager_ynh.git synced 2024-09-03 18:36:16 +02:00
fab-manager_ynh/scripts/change_url

55 lines
2.1 KiB
Bash

#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# INITIALIZE AND STORE SETTINGS
#=================================================
admin_mail=$(ynh_user_get_info --username="$admin" --key=mail)
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name="${app}-app" --action="stop" --log_path=systemd
ynh_systemd_action --service_name="${app}-worker" --action="stop" --log_path=systemd
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
ynh_change_url_nginx_config
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1
ynh_add_config --template="secrets.yml" --destination="$install_dir/config/secrets.yml"
chmod 400 "$install_dir/config/secrets.yml"
chown "$app:$app" "$install_dir/config/secrets.yml"
#=================================================
# GENERIC FINALISATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name="${app}-app" --action="start" --log_path=systemd
ynh_systemd_action --service_name="${app}-worker" --action="start" --log_path=systemd --line_match="Schedules Loaded"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last