48 lines
1015 B
Bash
48 lines
1015 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m'
|
|
|
|
log() {
|
|
echo -e "${GREEN}[bigtime]${NC} $*"
|
|
}
|
|
|
|
warn() {
|
|
echo -e "${YELLOW}[bigtime]${NC} $*"
|
|
}
|
|
|
|
SYSTEMD_UNITS=(
|
|
bigtime-agent.service
|
|
bigtime-trading.service
|
|
bigtime-news.service
|
|
bigtime-runtime.service
|
|
)
|
|
|
|
NGINX_CONF="/etc/nginx/conf.d/bigtime.conf"
|
|
ENV_FILE="/etc/bigtime/bigtime.env"
|
|
|
|
for unit in "${SYSTEMD_UNITS[@]}"; do
|
|
if systemctl list-unit-files "${unit}" >/dev/null 2>&1; then
|
|
warn "Stopping ${unit}"
|
|
sudo systemctl disable --now "${unit}" || true
|
|
sudo rm -f "/etc/systemd/system/${unit}"
|
|
fi
|
|
done
|
|
|
|
sudo systemctl daemon-reload || true
|
|
|
|
if [[ -f "${NGINX_CONF}" ]]; then
|
|
warn "Removing nginx config ${NGINX_CONF}"
|
|
sudo rm -f "${NGINX_CONF}"
|
|
sudo nginx -t && sudo systemctl reload nginx || true
|
|
fi
|
|
|
|
if [[ -f "${ENV_FILE}" ]]; then
|
|
warn "Keeping env file ${ENV_FILE}"
|
|
warn "Delete it manually if you want a full cleanup."
|
|
fi
|
|
|
|
log "BigTime production service uninstall finished."
|