Add bash/dovecot/validate.cpanel.MD

This commit is contained in:
2024-11-01 15:35:52 +00:00
parent 3d8cd286fd
commit 66c9873518
+26
View File
@@ -0,0 +1,26 @@
```bash
#!/bin/bash
# Ensure we're using Bash
if [ -z "$BASH_VERSION" ]; then
echo "This script must be run with Bash."
exit 1
fi
tail -F /var/log/dovecot.log | while read -r line; do
if echo "$line" | grep -q "Login: user=<[^@]\+@[^>]\+>"; then
domain=$(echo "$line" | sed -n 's/.*Login: user=<[^@]\+@\([^>]\+\)>.*/\1/p')
if [ -n "$domain" ]; then
owner=$( /scripts/whoowns "$domain" )
if [ -z "$owner" ]; then
echo "Domain $domain does not exist."
else
echo "Domain $domain exists and is owned by $owner."
fi
fi
fi
done
```