#!/bin/bash

res=$(systemctl list-unit-files | grep -E 'firebird-[a-z]*\.service')
if [ ! -n "$res" ]; then
    echo "Firebird server not found, installation is aborted"
    exit 1
fi

res=$(systemctl list-unit-files | grep 'aisexpert-web-backend.service')
if [ -n "$res" ]; then
    systemctl stop    aisexpert-web-backend.service
    systemctl disable aisexpert-web-backend.service
fi

res=$(systemctl list-unit-files | grep 'nginx.service')
if [ -n "$res" ]; then
    systemctl stop    nginx.service
    systemctl disable nginx.service
fi

exit 0
