Want to subscribe to topics you're interested in?
Become a Member

How To Disable eMail Alert cacheenabler cron

Discussion in 'Blogs & CMS usage' started by tua.one, Nov 27, 2021.

  1. tua.one

    tua.one New Member

    9
    0
    1
    Nov 27, 2021
    Ratings:
    +0
    Local Time:
    9:48 AM
    hello
    eva2000

    my name is Tua.
    i use centminmod 123.09beta01.
    everyday i receive many emails about cron cacheenabler.
    How To Disable eMail Alert
    you can see image -> https://ibb.co/Jdm0m0M

    [​IMG]

    my crontab -e


    Code:
    13 23 * * * /usr/local/src/centminmod/tools/autoprotect.sh >/dev/null 2>&1
    0 */4 * * * /usr/bin/cminfo_updater 2>/dev/null
    #*/15 * * * * sleep 115s ; wget -O - -q -t 1 /home/nginx/domains/gamestua.com/public/wp-cron.php > /dev/null 2>&1
    16 23 * * * echo "gamestua.com cacheenabler cron"; sleep 236s ; rm -rf /home/nginx/domains/gamestua.com/public/wp-content/cache/cache-enabler/* > /dev/null 2>&1
    0 */12 * * * sleep 466s ;/root/tools/wp_updater_gamestua.com.sh >/dev/null 2>&1
    #*/15 * * * * sleep 861s ; wget -O - -q -t 1 /home/nginx/domains/tua.one/wp-cron.php > /dev/null 2>&1
    16 23 * * * echo "tua.one cacheenabler cron"; sleep 147s ; rm -rf /home/nginx/domains/tua.one/public/wp-content/cache/cache-enabler/* > /dev/null 2>&1
    0 */12 * * * sleep 750s ;/root/tools/wp_updater_tua.one.sh >/dev/null 2>&1
    19 02 * * * /root/tools/phpmyadmin_update.sh >/dev/null 2>&1
    #*/15 * * * * sleep 815s ; wget -O - -q -t 1 https://howtua.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
    16 23 * * * echo "howtua.com cacheenabler cron"; sleep 270s ; rm -rf /home/nginx/domains/howtua.com/public/wp-content/cache/cache-enabler/* > /dev/null 2>&1
    0 */8 * * * sleep 165s ;/root/tools/wp_updater_howtua.com.sh >/dev/null 2>&1
    5 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null
    0 0 * * 5 /usr/local/src/centminmod/tools/cf-authenticated-origin-cert-update.sh update >/dev/null 2>&1
    11 */12 * * * /usr/local/src/centminmod/tools/jetpackips.sh >/dev/null 2>&1
    30 12 * * * /root/backup.sh
    thanks you
     
  2. tua.one

    tua.one New Member

    9
    0
    1
    Nov 27, 2021
    Ratings:
    +0
    Local Time:
    9:48 AM
  3. tua.one

    tua.one New Member

    9
    0
    1
    Nov 27, 2021
    Ratings:
    +0
    Local Time:
    9:48 AM
    as i find out use > /dev/null 2>&1 to not receive emails
    i see my crontab -e
    i have > /dev/null 2>&1 .
    but still many email everyday

    Code:
    Subject: Cron <root@php> echo "tua.one cacheenabler cron"; sleep 147s ; rm -rf /home/nginx/domains/tua.one/public/wp-content/cache/cache-enabler/* > /dev/null 2>&1
    Content-Type: text/plain; charset=UTF-8
    Auto-Submitted: auto-generated
    Precedence: bulk
    X-Cron-Env: <XDG_SESSION_ID=337090>
    X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/0>
    X-Cron-Env: <LANG=en_US.UTF-8>
    X-Cron-Env: <SHELL=/bin/sh>
    X-Cron-Env: <HOME=/root>
    X-Cron-Env: <PATH=/usr/bin:/bin>
    X-Cron-Env: <LOGNAME=root>
    X-Cron-Env: <USER=root>
    Message-Id: <20211126161828.BFC9FF61DB@php.tua.one>
    Date: Fri, 26 Nov 2021 23:16:01 +0700 (+07)
    X-Yandex-Forward: e21924a2fff04843af1f62bc65b4970d
    
    tua.one cacheenabler cron
     
  4. eva2000

    eva2000 Administrator Staff Member

    54,098
    12,177
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,735
    Local Time:
    12:48 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Ah you came across a bug! The problem is I need to silence each command line with >/dev/null 2>&1, but those cronjobs are multi-line with the semi-colon ; which is considered a separate command line. So I need to add >/dev/null 2>&1 before each semi-colon; instance. I'll update Centmin Mod 123.09beta01 sometime within next 8hrs so that new centmin.sh menu option 22 Wordpress installs don't have the issue.

    For existing installs and cronjobs, you'll need to apply this manual command line fix until I figure out how to add it to Centmin Mod itself.

    The below commands are to run in SSH session as root user

    Step 1. backup all cronjobs to a backup file assigned to backup_cron variable

    Code (Text):
    # backup all cronjobs to /etc/centminmod/cronjobs/
    mkdir -p /etc/centminmod/cronjobs
    backup_cron="/etc/centminmod/cronjobs/cronjob-backup-$(date +"%d%m%y-%H%M%S").txt"
    crontab -l > $backup_cron


    Backups will be saved at /etc/centminmod/cronjobs i.e. /etc/centminmod/cronjobs/cronjob-backup-271121-131330.txt
    Code (Text):
    ls -lahrt /etc/centminmod/cronjobs | grep 'cronjob-backup'
    -rw-r--r--  1 root root 2.5K Nov 27 13:13 cronjob-backup-271121-131330.txt
    


    Step 2.
    create a temp cronjob-fixed file with backup copy of your existing cronjobs

    Code (Text):
    # create temp cronjob-fixed file
    crontab -l > /etc/centminmod/cronjobs/cronjob-fixed


    Step 3. Apply sed replacement command fixes to insert > /dev/null 2>&1 just before semi-colon; instances

    Code (Text):
    # sed fixes applied to /etc/centminmod/cronjobs/cronjob-fixed
    sed -i 's|s ;/root/tools/wp_updater|s \> /dev/null 2\>\&1;/root/tools/wp_updater|g' /etc/centminmod/cronjobs/cronjob-fixed
    sed -i 's|cacheenabler cron";|cacheenabler cron" \> /dev/null 2\>\&1;|g' /etc/centminmod/cronjobs/cronjob-fixed
    sed -i 's|s ; rm -rf |s \> /dev/null 2\>\&1; rm -rf |g' /etc/centminmod/cronjobs/cronjob-fixed
    sed -i 's|s ; curl -skD - -H "Cookie|s \> /dev/null 2\>\&1; curl -skD - -H "Cookie|g' /etc/centminmod/cronjobs/cronjob-fixed
    sed -i 's|s ; wget -O - -q -t 1 http|s \> /dev/null 2\>\&1; wget -O - -q -t 1 http|g' /etc/centminmod/cronjobs/cronjob-fixed
    sed -i 's|s ; wget -4 -O - -q -t 1 http|s \> /dev/null 2\>\&1; wget -O - -q -t 1 http|g' /etc/centminmod/cronjobs/cronjob-fixed


    Step 4. For your eyes only to visually compare your backup and cronjob-fixed files to see if it worked

    Code (Text):
    # compare backup cronjob with cronjob-fixed file
    diff -u $backup_cron /etc/centminmod/cronjobs/cronjob-fixed


    Step 5. Now import and overwrite your cronjob-fixed version into your cronjob system

    Code (Text):
    # reload fixed cronjobs into crontab
    crontab /etc/centminmod/cronjobs/cronjob-fixed


    Step 6. Verify your cronjobs are fixed

    Code (Text):
    cronjob -l


    If for whatever reason, the resulting fixed cronjobs is messed up, you can always restore from the backup we made in step 1 i.e. for reloading and restoring /etc/centminmod/cronjobs/cronjob-backup-271121-131330.txt

    Code (Text):
    crontab /etc/centminmod/cronjobs/cronjob-backup-271121-131330.txt


    Step 7. Then remove the temp cronjob-fixed file
    Code (Text):
    # remove temp cronjob-fixed file
    rm -f /etc/centminmod/cronjobs/cronjob-fixed


    Let me know how that goes for you.
     
  5. tua.one

    tua.one New Member

    9
    0
    1
    Nov 27, 2021
    Ratings:
    +0
    Local Time:
    9:48 AM
    thanks you admin .
    you are the best
     
  6. tua.one

    tua.one New Member

    9
    0
    1
    Nov 27, 2021
    Ratings:
    +0
    Local Time:
    9:48 AM
    hello admin
    eva2000
    cron still sending emails

    Wordpress WP-CLI Auto Update Sun Nov 28 00:12:33 +07 2021
    please help me .
    thanks[​IMG]
     

    Attached Files:

    Last edited: Nov 28, 2021
  7. eva2000

    eva2000 Administrator Staff Member

    54,098
    12,177
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,735
    Local Time:
    12:48 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    That one is normal wordpress auto updater wp_updater_yourdomain.com.sh scripts is meant to send you an email as expected - it auto updates Wordpress every 8hrs. Just set a label for the subject + email to filter it and add a label/mail folder for them - which is what I usually do.

    i.e. if you created centmin.sh menu option 22 Wordpress install, the email it asked you for will populate /root/tools/wp_updater_yourdomain.com.sh for sending Wordpress plugin update notifications.
    Code (Text):
    egrep -i '^email|^emailfrom' /root/tools/wp_updater_yourdomain.com.sh
    EMAIL=youremail@address
    EMAILFROM=youremail@address
    
     
  8. eva2000

    eva2000 Administrator Staff Member

    54,098
    12,177
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,735
    Local Time:
    12:48 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Oh wait, your screenshot says from/to root@domain not email address.

    Did you verify if after above 7 step fixes, that cronjob listing shows each semi-colon ; has a > /dev/null 2>&1 entry now?

    listing cronjobs
    Code (Text):
    crontab -l | grep wp_updater

    example
    Code (Text):
    crontab -l | grep wp_updater
    0 */8 * * * sleep 226s > /dev/null 2>&1;/root/tools/wp_updater_yourdomain.com.sh >/dev/null 2>&1
    


    Also for posting output from commands instead of screenshots, to keep the formatting, you might want to use CODE tags for code How to use forum BBCODE code tags :)
     
  9. tua.one

    tua.one New Member

    9
    0
    1
    Nov 27, 2021
    Ratings:
    +0
    Local Time:
    9:48 AM
    this code.
    Code:
     crontab -l | grep wp_updater
    0 */12 * * * sleep 466s > /dev/null 2>&1;/root/tools/wp_updater_gamestua.com.sh >/dev/null 2>&1
    0 */12 * * * sleep 750s > /dev/null 2>&1;/root/tools/wp_updater_tua.one.sh >/dev/null 2>&1
    0 */8 * * * sleep 165s > /dev/null 2>&1;/root/tools/wp_updater_howtua.com.sh >/dev/null 2>&1
    - yes i use root@php.tua.one for email
     
  10. eva2000

    eva2000 Administrator Staff Member

    54,098
    12,177
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,735
    Local Time:
    12:48 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Oh so when wordpress install via centmin.sh menu option 22 asked for your wordpres email, you used that root@php.tua.one email or did you actually use your @yourdomain.com email? Where yourdomain.com is your Wordpress site's domain name. If you used root@php.tua.one, then that looks okay to me then.

    You can always just edit each cronjob wp_updater_*.sh script's EMAIL/EMAILFROM variables to change the email address later too.
     
  11. tua.one

    tua.one New Member

    9
    0
    1
    Nov 27, 2021
    Ratings:
    +0
    Local Time:
    9:48 AM
    oki. thanks admin.
    have nice a day