#!/bin/bash set -e echo "Checking drift between git repo and live server..." DIFF_FOUND=0 echo echo "Comparing /etc/rsyslog.conf" if ! diff -u rsyslog.conf /etc/rsyslog.conf; then DIFF_FOUND=1 fi echo echo "Comparing rsyslog.d configs" for file in rsyslog.d/*.conf; do base=$(basename "$file") target="/etc/rsyslog.d/$base" if [ ! -f "$target" ]; then echo "Missing on server: $target" DIFF_FOUND=1 continue fi if ! diff -u "$file" "$target"; then DIFF_FOUND=1 fi done if [ "$DIFF_FOUND" -eq 0 ]; then echo echo "No drift detected." exit 0 else echo echo "Drift detected!" exit 1 fi