#!/bin/bash

source _common.sh
source /usr/share/yunohost/helpers

#=================================================
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression "Removing system configurations related to $app..."

if ynh_hide_warnings yunohost service status "${app}-web" >/dev/null; then
    yunohost service remove "${app}-web"
fi

if ynh_hide_warnings yunohost service status "${app}-worker" >/dev/null; then
    yunohost service remove "${app}-worker"
fi

ynh_config_remove_systemd "${app}-web"
ynh_config_remove_systemd "${app}-worker"

ynh_config_remove_nginx

ynh_nodejs_remove

ynh_safe_rm "/etc/cron.d/$app"

#=================================================
# END OF SCRIPT
#=================================================

ynh_script_progression "Removal of $app completed"
