1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/agendav_ynh.git synced 2024-09-03 20:36:12 +02:00
agendav_ynh/scripts/remove
2017-10-20 10:15:17 +02:00

34 lines
820 B
Bash

#!/bin/bash
# Source local helpers
source ./_common.sh
# Source app helpers
source /usr/share/yunohost/helpers
# Set app specific variables
app="$YNH_APP_INSTANCE_NAME"
dbname=$app
dbuser=$app
# Drop MySQL database and user
ynh_mysql_drop_db "$dbname" || true
ynh_mysql_drop_user "$dbuser" || true
# Retrieve domain from app settings
domain=$(ynh_app_setting_get "$app" domain)
# Delete app directory and configurations
rm -rf "/var/www/${app}" "/var/log/${app}"
rm -f "/etc/php5/fpm/pool.d/${app}.conf"
[[ -n $domain ]] && rm -f "/etc/nginx/conf.d/${domain}.d/${app}.conf"
# Reload services
service php5-fpm restart || true
service nginx reload || true
# Remove the user account
# (must be done after php-fpm restart)
id "$app" >/dev/null 2>&1 \
&& deluser --quiet --remove-home "$app" >/dev/null \
|| true