Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Need help with small shell script

Discussion in 'E-mail Discussion' started by tecwithquestion, Apr 16, 2015.

  1. tecwithquestion

    tecwithquestion Well-Known Member

    Joined:
    Oct 20, 2014
    Messages:
    57
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Hello

    I am using below script to monitor spam on server ::

    Code:
    #!/bin/bash
    EMAIL="user@email.com
    NOW=$(date +"%m-%d-%Y")
    FILE="cwd.$NOW.txt"
    grep "cwd=/home" /var/log/exim_mainlog | awk '{for(i=1;i<=10;i++){print $i}}' | sort | uniq -c | grep cwd | sort -n > /usr/local/cwd/$FILE
    echo "Mail queue at `hostname` has $MQUEUE messages!!!" | mail -s "CRITICAL ALERT: Mail queue" -a /usr/local/cwd/$FILE  $EMAIL
    fi
    
    Out put of this script is like ::

    Code:
      4 cwd=/home/xxx/public_htmlme/xxxx/public_html/xxxx/xxxx/xxx/xxx
      10 cwd=/home/xxxx/public_html/xxxx
      14 cwd=/home/xxxx/public_html
      30 cwd=/home/xxxx/public_html/xxxxt/wp-content/plugins/pie-register/classes
      61 cwd=/home/xxxx/public_html
      765 cwd=/home/xxxx/public_html/xxxx/media/kunena/avatars/resized/size200
    
    I want to have ::

    script will set permission to 0000 for a folder from which more than 500 emails sent out..

    Any help regarding this is highly appreciated.
     
    #1 tecwithquestion, Apr 16, 2015
    Last edited: Apr 16, 2015
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,802
    Likes Received:
    1,895
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice