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

51 lines
2.2 KiB
Text
Raw Permalink Normal View History

2023-05-26 17:16:13 +02:00
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
2024-07-14 18:15:20 +02:00
ynh_script_progression --message="Stopping $app's systemd services..." --weight=1
2023-05-26 17:16:13 +02:00
2024-07-14 18:15:20 +02:00
ynh_systemd_action --service_name="$app" --action="stop" --line_match="Stopped" "/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app-ui" --action="stop" --line_match="Stopped" --log_path="/var/log/$app/$app-ui.log"
ynh_systemd_action --service_name="$app-pict-rs" --action="stop" --line_match="Stopped" --log_path="/var/log/$app/$app-pict-rs.log"
2023-05-26 17:16:13 +02:00
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
ynh_change_url_nginx_config
#=================================================
# ADD A CONFIGURATION
#=================================================
2024-07-14 18:15:20 +02:00
ynh_script_progression --message="Updating $app's configuration file..." --weight=1
2023-05-26 17:16:13 +02:00
mkdir -p "$install_dir/config/"
2024-07-14 18:15:20 +02:00
ynh_add_config --template="lemmy.hjson" --destination="$install_dir/config/config.hjson"
2023-05-26 17:16:13 +02:00
chmod 400 "$install_dir/config/config.hjson"
2024-07-14 18:15:20 +02:00
chown "$app:$app" "$install_dir/config/config.hjson"
2023-05-26 17:16:13 +02:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
2024-07-14 18:15:20 +02:00
ynh_script_progression --message="Starting $app's systemd services..." --weight=1
2023-05-26 17:16:13 +02:00
2024-07-14 18:15:20 +02:00
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" --line_match="Starting http server at"
ynh_systemd_action --service_name="$app-ui" --action="start" --log_path="/var/log/$app/$app-ui.log" --line_match="http://0.0.0.0"
ynh_systemd_action --service_name="$app-pict-rs" --action="start" --log_path="/var/log/$app/$app-pict-rs.log" --line_match="starting in Actix runtime"
2023-05-26 17:16:13 +02:00
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last