Add full affine scripts
This commit is contained in:
52
affine/uninstall.sh
Executable file
52
affine/uninstall.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
. ./env.sh
|
||||
|
||||
services=(
|
||||
"$CONTAINER_PREFIX-$CONTAINER_SERVER.service"
|
||||
"$CONTAINER_PREFIX-$CONTAINER_POSTGRES.service"
|
||||
"$CONTAINER_PREFIX-$CONTAINER_REDIS.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_POSTGRES",
|
||||
"$CONTAINER_REDIS"
|
||||
)
|
||||
|
||||
for container in "${containers[@]}"; do
|
||||
if podman container exists "$containers"; then
|
||||
echo "Stop and delete existing container $containers"
|
||||
if podman inspect -f '{{.State.Running}}' "$containers" | grep -q true; then
|
||||
podman stop "$containers"
|
||||
fi
|
||||
podman rm "$containers"
|
||||
fi
|
||||
done
|
||||
|
||||
for service in "${services[@]}"; do
|
||||
systemctl --user disable --now $service
|
||||
rm $USER_SYSTEMD/$service
|
||||
done
|
||||
|
||||
systemctl --user daemon-reload
|
||||
|
||||
sudo rm -r $SERVICE_DIR
|
||||
crontab -l | grep -v "$AFFINE_ROOT/$BACKUP_FILE" | crontab -
|
||||
|
||||
echo "Uninstall complete. Manually run haproxy config to rebuild config. Manually remove data directory
|
||||
- $AFFINE_ROOT
|
||||
- $DB_DATA_LOCATION
|
||||
- $UPLOAD_LOCATION
|
||||
- $CONFIG_LOCATION
|
||||
if needed."
|
||||
Reference in New Issue
Block a user