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

44 lines
1.6 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping $app's systemd service..." --weight=1
ynh_systemd_action --service_name=$app --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 CONFIGURATION FILE
#=================================================
# Add newline at end of file if required
sed -i -e '$a\' "$data_dir/config.xml"
ynh_replace_string --match_string="<UrlBase>$old_path</UrlBase>" --replace_string="<UrlBase>$new_path</UrlBase>" --target_file="$data_dir/config.xml"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="CommandExecutor: Starting"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last