Files
aitbc/scripts/testing/debug-services.sh
aitbc1 bfe6f94b75
Some checks failed
AITBC CI/CD Pipeline / lint-and-test (3.11) (push) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.12) (push) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.13) (push) Has been cancelled
AITBC CI/CD Pipeline / test-cli (push) Has been cancelled
AITBC CI/CD Pipeline / test-services (push) Has been cancelled
AITBC CI/CD Pipeline / test-production-services (push) Has been cancelled
AITBC CI/CD Pipeline / security-scan (push) Has been cancelled
AITBC CI/CD Pipeline / build (push) Has been cancelled
AITBC CI/CD Pipeline / deploy-staging (push) Has been cancelled
AITBC CI/CD Pipeline / deploy-production (push) Has been cancelled
AITBC CI/CD Pipeline / performance-test (push) Has been cancelled
AITBC CI/CD Pipeline / docs (push) Has been cancelled
AITBC CI/CD Pipeline / release (push) Has been cancelled
AITBC CI/CD Pipeline / notify (push) Has been cancelled
Security Scanning / Bandit Security Scan (apps/coordinator-api/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (cli/aitbc_cli) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-core/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-crypto/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-sdk/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (tests) (push) Has been cancelled
Security Scanning / CodeQL Security Analysis (javascript) (push) Has been cancelled
Security Scanning / CodeQL Security Analysis (python) (push) Has been cancelled
Security Scanning / Dependency Security Scan (push) Has been cancelled
Security Scanning / Container Security Scan (push) Has been cancelled
Security Scanning / OSSF Scorecard (push) Has been cancelled
Security Scanning / Security Summary Report (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.11) (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.12) (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.13) (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-summary (push) Has been cancelled
chore: remove outdated documentation and reference files
- Remove debugging service documentation (DEBUgging_SERVICES.md)
- Remove development logs policy and quick reference guides
- Remove E2E test creation summary
- Remove gift certificate example file
- Remove GitHub pull summary documentation
2026-03-25 12:56:07 +01:00

116 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
# Debug script to identify malformed service names
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
print_status() {
echo -e "${BLUE}[DEBUG]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
print_status "Debugging AITBC service names..."
# Show raw systemctl output
print_status "Raw systemctl output for AITBC services:"
systemctl list-units --all | grep "aitbc-" | cat -A
echo ""
# Show each field separately
print_status "Analyzing service names field by field:"
systemctl list-units --all | grep "aitbc-" | while read -r line; do
echo "Raw line: '$line'"
# Extract each field
unit=$(echo "$line" | awk '{print $1}')
load=$(echo "$line" | awk '{print $2}')
active=$(echo "$line" | awk '{print $3}')
sub=$(echo "$line" | awk '{print $4}')
description=$(echo "$line" | cut -d' ' -f5-)
echo " Unit: '$unit'"
echo " Load: '$load'"
echo " Active: '$active'"
echo " Sub: '$sub'"
echo " Description: '$description'"
# Check if unit name is valid
if [[ "$unit" =~ [^a-zA-Z0-9\-\._] ]]; then
print_error " ❌ Invalid characters in unit name!"
echo " ❌ Hex representation: $(echo -n "$unit" | od -c)"
else
print_success " ✅ Valid unit name"
fi
echo ""
done
# Check for any hidden characters
print_status "Checking for hidden characters in service names:"
systemctl list-units --all | grep "aitbc-" | awk '{print $2}' | grep "\.service$" | while read -r service; do
echo "Service: '$service'"
echo "Length: ${#service}"
echo "Hex dump:"
echo -n "$service" | od -c
echo ""
done
# Show systemctl list-unit-files output
print_status "Checking systemctl list-unit-files:"
systemctl list-unit-files | grep "aitbc-" | cat -A
# Check service files on disk
print_status "Checking service files in /etc/systemd/system/:"
if [ -d "/etc/systemd/system" ]; then
find /etc/systemd/system/ -name "*aitbc*" -type f | while read -r file; do
echo "Found: $file"
basename "$file"
echo "Hex: $(basename "$file" | od -c)"
echo ""
done
fi
# Check service files in user directory
print_status "Checking service files in user directory:"
if [ -d "$HOME/.config/systemd/user" ]; then
find "$HOME/.config/systemd/user" -name "*aitbc*" -type f 2>/dev/null | while read -r file; do
echo "Found: $file"
basename "$file"
echo "Hex: $(basename "$file" | od -c)"
echo ""
done
fi
# Check for any encoding issues
print_status "Checking locale and encoding:"
echo "Current locale: $LANG"
echo "System encoding: $(locale charmap)"
echo ""
# Try to reload systemd daemon
print_status "Reloading systemd daemon to clear any cached issues:"
sudo systemctl daemon-reload
echo "Daemon reload completed"
echo ""
print_status "Debug complete. Review the output above to identify the source of the malformed service name."