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

60 lines
1.7 KiB
Text
Raw Normal View History

2015-10-21 13:03:49 +02:00
#!/bin/bash
set -u # treat unset variables as an error
2015-10-21 13:03:49 +02:00
2017-10-10 14:09:26 +02:00
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
2017-10-10 14:09:26 +02:00
#=================================================
# LOAD SETTINGS
#=================================================
domain=$(ynh_app_setting_get mattermost domain)
2015-10-21 13:03:49 +02:00
db_name="mattermost"
db_user="mmuser"
2017-10-10 14:09:26 +02:00
#=================================================
# STANDARD REMOVE
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
2015-10-21 13:03:49 +02:00
sudo supervisorctl stop mattermost
2017-10-10 14:09:26 +02:00
sudo rm -f /etc/supervisor/conf.d/mattermost.conf
2015-10-21 13:03:49 +02:00
2017-10-10 14:09:26 +02:00
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
2015-10-21 13:03:49 +02:00
# (DROP USER IF EXISTS is only available on MySQL >= 5.7, so we don't use it for now)
ynh_mysql_execute_as_root "DROP DATABASE IF EXISTS $db_name ; DROP USER $db_user@localhost ;"
2015-10-21 13:03:49 +02:00
2017-10-10 14:09:26 +02:00
#=================================================
# REMOVE APP MAIN DIR
#=================================================
2017-10-10 14:09:26 +02:00
sudo rm -rf /var/www/mattermost
sudo rm -rf /home/yunohost.app/mattermost
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
2015-10-21 14:33:49 +02:00
2015-10-21 13:03:49 +02:00
sudo rm -f /etc/nginx/conf.d/$domain.d/mattermost.conf
2015-10-21 14:33:49 +02:00
2017-10-10 14:09:26 +02:00
#=================================================
# REMOVE LOG FILE
#=================================================
sudo rm -f "/var/log/mattermost.log"
#=================================================
# REMOVE DEDICATED USER
#=================================================
sudo userdel mattermost