1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mattermost_ynh.git synced 2024-09-03 19:36:29 +02:00
mattermost_ynh/scripts/remove
2017-10-12 12:27:09 +05:30

61 lines
1.7 KiB
Bash
Executable file

#!/bin/bash
set -u # treat unset variables as an error
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get mattermost domain)
db_name="mattermost"
db_user="mmuser"
final_path="/var/www/$app"
data_path="/home/yunohost.app/$app"
#=================================================
# STANDARD REMOVE
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
sudo supervisorctl stop "$app"
sudo rm -f "/etc/supervisor/conf.d/${app}.conf"
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
ynh_mysql_remove_db "$db_user" "$db_name"
#=================================================
# REMOVE APP MAIN DIR
#=================================================
sudo rm -rf "$final_path"
sudo rm -rf "$data_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
sudo rm -f "/etc/nginx/conf.d/${domain}.d/${app}.conf"
#=================================================
# REMOVE LOG FILE
#=================================================
sudo rm -f "/var/log/${app}.log"
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_system_user_delete "$app"