1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/haste_ynh.git synced 2024-09-03 20:36:28 +02:00
haste_ynh/scripts/restore

29 lines
787 B
Text
Raw Normal View History

#!/bin/bash
# Exit on command errors and treat unset variables as an error
set -eu
# Load common variables and functions
source ./_common.sh
# Retrieve old app settings
domain=$(ynh_app_setting_get "$app" domain)
path=$(ynh_app_setting_get "$app" path)
is_public=$(ynh_app_setting_get "$app" is_public)
# Check domain/path availability
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|| ynh_die "Path not available: ${domain}${path}"
pre_inst_haste backup
# Restore NGINX configuration
sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
# Restart webserver and app
sudo systemctl reload nginx.service
sudo systemctl start "$app".service
# Add Haste to YunoHost's monitored services
sudo yunohost service add "$app" --log /var/log/"$app"/"$app".log