diff --git a/aggregator-agent/install.sh b/aggregator-agent/install.sh index a52a053..59b479f 100755 --- a/aggregator-agent/install.sh +++ b/aggregator-agent/install.sh @@ -174,6 +174,18 @@ register_agent() { # Create config directory mkdir -p /etc/aggregator + # Clean up old configuration files (prevents conflicts during reinstall/upgrade) + if [ -f /etc/aggregator/.env ]; then + echo "Removing old .env file..." + rm -f /etc/aggregator/.env + echo "✓ Old .env file removed" + fi + if [ -f /etc/aggregator/config.json ]; then + echo "Removing old config.json file..." + rm -f /etc/aggregator/config.json + echo "✓ Old config.json file removed" + fi + # Set SELinux context for config directory if SELinux is enabled if command -v getenforce >/dev/null 2>&1 && [ "$(getenforce)" != "Disabled" ]; then echo "Setting SELinux context for config directory..."