Welcome to Centmin Mod Community
Become a Member

Sysadmin Cron Jobs for WP-CLI Auto Update Suddenly Stopped

Discussion in 'System Administration' started by mistermr, Dec 18, 2018.

  1. mistermr

    mistermr New Member

    9
    0
    1
    Dec 18, 2018
    Ratings:
    +0
    Local Time:
    11:58 PM
    First off, LOVE this tool. It bridges the gap between managed and unmanaged servers.

    I had 1 WP domain running and WP-CLI ran normally, but after I installed a second domain through the centmin tool, cronjobs for WP-CLI stopped. I've fiddled with the settings a few different ways (added bin/sh and changed the time to every 12 hrs) and just can't get them to run. I don't really care that both updaters run at the same time, my VPS can handle it. Any help is greatly appreciated.

    Here's my crontab output:
    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 161s ; wget -O - -q -t 1 http://mydomain1.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
    0 */12 * * * bin/sh /root/tools/wp_updater_mydomain1.com.sh >/dev/null 2>&1
    18 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null
    #*/15 * * * * sleep 336s ; wget -O - -q -t 1 http://mydomain2.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
    16 23 * * * echo "mydomain2.com cacheenabler cron"; sleep 316s ; rm -rf /home/nginx/domains/mydomain2.com/public/wp-content/cache/cache-enabler/* > /dev/null 2>&10,
    0 */12 * * * bin/sh /root/tools/wp_updater_mydomain2.com.sh >/dev/null 2>&1
    
    Please fill in any relevant information that applies to you:
    • CentOS Version: CentOS 7 64bit ?
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: 1.15.6
    • When was last time updated Centmin Mod code base ? : today
    • Persistent Config: LETSENCRYPT_DETECT='y'
     
  2. eva2000

    eva2000 Administrator Staff Member

    46,183
    10,499
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,278
    Local Time:
    5:58 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    verify if cronjobs actually ran via the /var/log/cron log you can grep filter the log for 'wp_updater_'
    Code (Text):
    grep 'wp_updater_' /var/log/cron | tail -10; date
    

    Then will filter and list last 10 entries with word 'wp_updater_' in it and then print current server date time and you can see if cronjobs have ran

    if they have ran, then could be your email client/provide logging the emailed wp-cli updates to spam/junk box in which case see Email - Steps to ensure your site/server email doesn't end up in spam inboxes
     
  3. mistermr

    mistermr New Member

    9
    0
    1
    Dec 18, 2018
    Ratings:
    +0
    Local Time:
    11:58 PM
    Looks like it stopped on Dec 10, right after running on the 12hr schedule for the first time.
    Code:
    Dec  7 08:00:01 domain1 CROND[14100]: (root) CMD (sleep 239s ;/root/tools/wp_updater_domain1.com.sh >/dev/null 2>&1)
    Dec  7 16:00:01 domain1 CROND[16940]: (root) CMD (sleep 239s ;/root/tools/wp_updater_domain1.com.sh >/dev/null 2>&1)
    Dec  8 00:00:01 domain1 CROND[20766]: (root) CMD (sleep 239s ;/root/tools/wp_updater_domain1.com.sh >/dev/null 2>&1)
    Dec  8 08:00:01 domain1 CROND[24444]: (root) CMD (sleep 239s ;/root/tools/wp_updater_domain1.com.sh >/dev/null 2>&1)
    Dec  8 16:00:01 domain1 CROND[27818]: (root) CMD (sleep 239s ;/root/tools/wp_updater_domain1.com.sh >/dev/null 2>&1)
    Dec  9 00:00:01 domain1 CROND[32560]: (root) CMD (sleep 239s ;/root/tools/wp_updater_domain1.com.sh >/dev/null 2>&1)
    Dec  9 08:00:01 domain1 CROND[3988]: (root) CMD (sleep 239s ;/root/tools/wp_updater_domain1.com.sh >/dev/null 2>&1)
    Dec  9 16:00:01 domain1 CROND[8380]: (root) CMD (sleep 239s ;/root/tools/wp_updater_domain1.com.sh >/dev/null 2>&1)
    Dec 10 00:00:01 domain1 CROND[30497]: (root) CMD (sleep 977s ;/root/tools/wp_updater_domain2.com.sh >/dev/null 2>&1)
    Dec 10 00:00:01 domain1 CROND[30496]: (root) CMD (sleep 239s ;/root/tools/wp_updater_domain1.com.sh >/dev/null 2>&1)
    
     
  4. eva2000

    eva2000 Administrator Staff Member

    46,183
    10,499
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,278
    Local Time:
    5:58 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    it's because you added bin/sh in front of each of those cronjobs, it's invalid path anyway, remove it and should work
     
  5. mistermr

    mistermr New Member

    9
    0
    1
    Dec 18, 2018
    Ratings:
    +0
    Local Time:
    11:58 PM
    I added those today and I'll remove, but it wasn't working before adding them. I even tried updating the time to run every 5 minutes and rebooted the server, but still nothing (domain 2 has updates, so I know it's not running).
     
  6. eva2000

    eva2000 Administrator Staff Member

    46,183
    10,499
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,278
    Local Time:
    5:58 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    how are you editing cronjobs ?

    use crontab -l to view current cronjobs and crontab -e command to invoke nano text editor see guide at HowTo: Add Jobs To cron Under Linux or UNIX?

    example of out of box centmin mod setup cronjobs excluding wordpress wp-cli
    Code (Text):
    crontab -l
    13 23 * * * /usr/local/src/centminmod/tools/autoprotect.sh >/dev/null 2>&1
    0 */4 * * * /usr/bin/cminfo_updater 2>/dev/null
    
     
  7. mistermr

    mistermr New Member

    9
    0
    1
    Dec 18, 2018
    Ratings:
    +0
    Local Time:
    11:58 PM
    crontab -e

    Odd...I just updated to run every 2 minutes and it updated the site. I'm wondering if I had a syntax error that didn't error out when I saved.
    I changed the times to:
    Code:
    0 */12 * * * /root/tools/wp_updater_mydomain.com.sh >/dev/null 2>&1
    
    That should run every 12 hours (00:00 and 12:00), correct?

    (thanks again for your help!)
     
  8. eva2000

    eva2000 Administrator Staff Member

    46,183
    10,499
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,278
    Local Time:
    5:58 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    yup should run every 12 hrs