libreerp_ynh/scripts/remove

24 lines
579 B
Bash

#!/bin/bash
app=odoo
domain=$(sudo yunohost app setting $app domain)
database=${domain//./-}
instance=$(sudo yunohost app setting $app instance)
# Remove database
sudo -u postgres dropdb $database
# If removing master instance, remove Odoo.
if [ "$instance" = "master" ]; then
# Remove Odoo
sudo yunohost service stop odoo
sudo apt-get remove odoo -y
sudo apt-get remove wkhtmltopdf -y
sudo yunohost service remove odoo
fi
# Remove NGINX conf
sudo rm /etc/nginx/conf.d/$domain.d/$app.conf
# Reload
sudo service nginx reload
sudo yunohost app ssowatconf