seafile_ynh/scripts/remove

66 lines
1.9 KiB
Text
Raw Normal View History

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
2020-11-17 23:49:06 +01:00
# Import common cmd
source ./experimental_helper.sh
source ./_common.sh
2017-07-21 14:56:41 +02:00
# Source YunoHost helpers
source /usr/share/yunohost/helpers
seafile_version=$(ynh_app_upstream_version)
#=================================================
# STANDARD REMOVE
#=================================================
2019-06-11 22:28:26 +02:00
ynh_script_progression --message="Stoping services..."
# Stop all services
ynh_systemd_action --service_name seafile --action stop
ynh_systemd_action --service_name seahub --action stop
2018-05-08 10:12:58 +02:00
# Force to kill all process in case of a process is not stoped cleanly
pkill -f seafile-controller || true
pkill -f seaf-server || true
pkill -f ccnet-server || true
pkill -f seahub || true
2019-06-11 22:28:26 +02:00
ynh_script_progression --message="Removing logs..."
ynh_secure_remove --file=/var/log/seafile
ynh_script_progression --message="Removing code..."
ynh_secure_remove --file=/var/www/$app
ynh_secure_remove --file=/opt/yunohost/$app
# Remove databases
2019-06-11 22:28:26 +02:00
ynh_script_progression --message="Removing databases..."
db_helper=ynh_"mysql"_remove_db
$db_helper --db_name ccnetdb --db_user seafile
$db_helper --db_name seahubdb --db_user seafile
2019-06-11 22:28:26 +02:00
# Remove systemd service
ynh_script_progression --message="Removing systemd units..."
ynh_remove_systemd_config --service seafile
ynh_remove_systemd_config --service seahub
2017-07-21 14:56:41 +02:00
2019-06-11 22:28:26 +02:00
# Remove nginx config
2019-09-10 22:50:07 +02:00
ynh_script_progression --message="Removing nginx configuration..."
2019-06-11 22:28:26 +02:00
ynh_remove_nginx_config
2017-07-21 14:56:41 +02:00
# Remove logrotate
ynh_remove_logrotate
2019-06-11 22:28:26 +02:00
# Remove the dedicated fail2ban config
2019-09-10 22:50:07 +02:00
ynh_script_progression --message="Removing fail2ban configuration..."
2019-06-11 22:28:26 +02:00
ynh_remove_fail2ban_config
2019-09-10 22:50:07 +02:00
ynh_script_progression --message="Removing seafile service..."
2019-06-11 22:28:26 +02:00
yunohost service remove seafile
yunohost service remove seahub
2019-06-11 22:28:26 +02:00
ynh_script_progression --message="Removal of $app completed" --last
2020-11-29 17:29:51 +01:00
sleep 1