Last active
May 6, 2016 07:22
-
-
Save cPLevey/3b09f05af7ed2bb5dd02c0415f764e45 to your computer and use it in GitHub Desktop.
outgoing_mail_suspended_users fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Quick fix script for CPANEL-5806 | |
| # Ver. 0.05 | |
| CMP_ERROR_COUNT=$(grep 'check_mail_permissions' /var/log/exim_mainlog |wc -l); | |
| CREATED_FILE=0; | |
| if [ "$CMP_ERROR_COUNT" -ne "0" ]; then | |
| echo "$CMP_ERROR_COUNT errors found in the exim main log referencing a check_mail_permissions issue."; | |
| echo "Example(s):"; | |
| echo "==========="; | |
| grep 'check_mail_permissions' /var/log/exim_mainlog |tail -n10; | |
| echo "==========="; | |
| echo "Starting fix..."; | |
| if [ ! -f /etc/outgoing_mail_suspended_users ]; then | |
| echo "Suspended outgoing mail users file does not exist..."; | |
| echo "Creating file..."; | |
| touch '/etc/outgoing_mail_suspended_users'; | |
| CREATED_FILE=1; | |
| echo "File created..."; | |
| echo "Setting permissions..."; | |
| chown root:mail '/etc/outgoing_mail_suspended_users'; | |
| chmod 640 '/etc/outgoing_mail_suspended_users'; | |
| ls -lha /etc/outgoing_mail_suspended_users; | |
| else | |
| echo "Suspended outgoing mail users file already exists:"; | |
| ls -lha /etc/outgoing_mail_suspended_users; | |
| fi | |
| if [ ! -f /etc/outgoing_mail_hold_users ]; then | |
| echo "Mail hold outgoing users file does not exist..."; | |
| echo "Creating file..."; | |
| touch '/etc/outgoing_mail_hold_users'; | |
| CREATED_FILE=1; | |
| echo "File created..."; | |
| echo "Setting permissions..."; | |
| chown root:mail '/etc/outgoing_mail_hold_users'; | |
| chmod 640 '/etc/outgoing_mail_hold_users'; | |
| ls -lha /etc/outgoing_mail_hold_users; | |
| else | |
| echo "Mail hold outgoing users file already exists:"; | |
| ls -lha /etc/outgoing_mail_hold_users; | |
| fi | |
| echo "Finishing up and restarting exim if needed..."; | |
| if [ "$CREATED_FILE" -ne "0" ]; then | |
| echo "Fixes require an exim restart."; | |
| /scripts/restartsrv_exim; | |
| fi | |
| echo "Making sure exim is running..."; | |
| IS_EXIM_RUNNING=$(/scripts/restartsrv_exim --status |grep running); | |
| if [ -z "$IS_EXIM_RUNNING" ]; then | |
| echo "Exim doesn't appear to be running. Something is wrong."; | |
| else | |
| echo "Exim is running, all good."; | |
| fi | |
| else | |
| echo "No errors referencing /etc/outgoing_mail_suspended_users were found."; | |
| echo "Fix did not run."; | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment