Files
customer-installer/delete_stopped_lxcs.sh
Wolfgang ff1526cc83 feat: Auto-import n8n RAG workflow with credentials
- Fixed n8n API login: use 'emailOrLdapLoginId' instead of 'email'
- Added n8n_setup_rag_workflow() function to libsupabase.sh
- Creates PostgreSQL and Ollama credentials automatically
- Imports RAG KI-Bot workflow with correct credential references
- Removed tags from workflow JSON (API validation issue)
- Step 10 now fully automated: credentials + workflow import

Tested successfully on container sb-1769173910
2026-01-23 14:15:16 +01:00

69 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
# delete_stopped_lxc.sh - Löscht alle gestoppten LXC Container auf PVE
set -e
# Farben für Output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo -e "${YELLOW}=== Gestoppte LXC Container finden ===${NC}\n"
# Array für gestoppte Container
declare -a STOPPED_CTS
# Alle Container durchgehen und gestoppte finden
while read -r line; do
VMID=$(echo "$line" | awk '{print $1}')
STATUS=$(echo "$line" | awk '{print $2}')
NAME=$(echo "$line" | awk '{print $3}')
if [[ "$STATUS" == "stopped" ]]; then
STOPPED_CTS+=("$VMID:$NAME")
echo -e " ${RED}[STOPPED]${NC} CT $VMID - $NAME"
fi
done < <(pct list | tail -n +2)
# Prüfen ob gestoppte Container gefunden wurden
if [[ ${#STOPPED_CTS[@]} -eq 0 ]]; then
echo -e "\n${GREEN}Keine gestoppten Container gefunden.${NC}"
exit 0
fi
echo -e "\n${YELLOW}Gefunden: ${#STOPPED_CTS[@]} gestoppte Container${NC}\n"
# Bestätigung anfordern
read -p "Möchten Sie ALLE gestoppten Container unwiderruflich löschen? (ja/nein): " CONFIRM
if [[ "$CONFIRM" != "ja" ]]; then
echo -e "${GREEN}Abgebrochen. Keine Container wurden gelöscht.${NC}"
exit 0
fi
# Zweite Bestätigung
read -p "Sind Sie WIRKLICH sicher? Tippen Sie 'LÖSCHEN' ein: " CONFIRM2
if [[ "$CONFIRM2" != "LÖSCHEN" ]]; then
echo -e "${GREEN}Abgebrochen. Keine Container wurden gelöscht.${NC}"
exit 0
fi
echo -e "\n${RED}=== Lösche Container ===${NC}\n"
# Container löschen
for CT in "${STOPPED_CTS[@]}"; do
VMID="${CT%%:*}"
NAME="${CT##*:}"
echo -n "Lösche CT $VMID ($NAME)... "
if pct destroy "$VMID" --purge 2>/dev/null; then
echo -e "${GREEN}OK${NC}"
else
echo -e "${RED}FEHLER${NC}"
fi
done
echo -e "\n${GREEN}=== Fertig ===${NC}"