#!/bin/bash set -u # treat unset variables as an error # Source app helpers source /usr/share/yunohost/helpers # Read configuration domain=$(ynh_app_setting_get mattermost domain) db_name="mattermost" db_user="mmuser" # Stop service sudo supervisorctl stop mattermost # Remove sources and data sudo rm -rf /var/www/mattermost sudo rm -rf /home/yunohost.app/mattermost # Remove database ynh_mysql_execute_as_root "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;" # Remove uploaded files # Delete SMTP user sudo userdel mattermost # Remove configuration files sudo rm -f /etc/nginx/conf.d/$domain.d/mattermost.conf sudo rm -f /etc/supervisor/conf.d/mattermost.conf # Remove log files sudo rm -f /var/log/mattermost.log