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

65 lines
2.2 KiB
Text
Raw Normal View History

2021-05-12 00:42:40 +02:00
#!/bin/bash
2017-06-02 18:46:29 +02:00
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2017-06-05 13:06:12 +02:00
source _common.sh
2017-06-02 18:46:29 +02:00
source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
2019-05-02 20:44:22 +02:00
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
2021-05-12 00:42:40 +02:00
ynh_script_progression --message="Stopping a systemd service..." --weight=1
2019-05-02 20:44:22 +02:00
2021-05-12 00:42:40 +02:00
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
2019-05-02 20:44:22 +02:00
2017-06-02 18:46:29 +02:00
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
2020-10-13 09:08:33 +02:00
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
2017-06-02 18:46:29 +02:00
2023-06-09 22:09:36 +02:00
ynh_change_url_nginx_config
2017-06-02 18:46:29 +02:00
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# CHANGE URL IN CONFIG FILE
2017-06-02 18:46:29 +02:00
#=================================================
ynh_script_progression --message="Editing config file..." --weight=2
2020-06-30 17:57:11 +02:00
domain="$new_domain"
2020-06-30 23:13:46 +02:00
path_url="$new_path"
# port is already defined in this file
2020-06-30 17:57:11 +02:00
2023-06-09 22:09:36 +02:00
ynh_add_config --template="config.json5" --destination="$install_dir/config.json5"
2017-06-02 18:46:29 +02:00
2023-06-09 22:09:36 +02:00
chmod 400 "$install_dir/config.json5"
chown $app:$app "$install_dir/config.json5"
2021-05-12 20:33:21 +02:00
2017-06-02 18:46:29 +02:00
#=================================================
# GENERIC FINALISATION
2019-05-02 20:44:22 +02:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
2020-07-01 10:20:07 +02:00
ynh_script_progression --message="Starting a systemd service..." --weight=1
2019-05-02 20:44:22 +02:00
2021-05-12 00:42:40 +02:00
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Server started"
2019-05-02 20:44:22 +02:00
2017-06-02 18:46:29 +02:00
#=================================================
# RELOAD NGINX
#=================================================
2020-10-13 09:08:33 +02:00
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
2017-06-02 18:46:29 +02:00
2019-04-18 19:58:47 +02:00
ynh_systemd_action --service_name=nginx --action=reload
2019-02-10 15:02:38 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2021-05-12 00:42:40 +02:00
ynh_script_progression --message="Change of URL completed for $app" --last