Files
linux-install-helper/airtrail-wip/uninstall.sh

36 lines
917 B
Bash
Raw Normal View History

#!/bin/bash
set -eu
. ./env.sh
services=("$CONTAINER_PREFIX-$CONTAINER_SERVICE.service"
"$CONTAINER_PREFIX-$CONTAINER_DB.service"
)
for service in "${services[@]}"; do
if systemctl --user list-units --full --all | grep -q "$service"; then
echo "Stopping $service..."
systemctl --user stop $service
echo "$service stopped."
fi
done
containers=(
"$CONTAINER_SERVER"
"$CONTAINER_DB"
)
for container in "${containers[@]}"; do
if podman container exists "$container"; then
echo "Stop and delete existing container $container"
if podman inspect -f '{{.State.Running}}' "$container" | grep -q true; then
podman stop "$container"
fi
podman rm "$container"
fi
done
for service in "${services[@]}"; do
systemctl --user disable --now $service
rm $USER_SYSTEMD/$service
done
sudo rm -rf $HAPROXY_CFG_DIR/services/$DOMAIN