Learn about Centmin Mod LEMP Stack today
Become a Member

Beta Branch update inc/wpsetup.inc update /root/tools/wp_updater_${vhostname}.sh 123.09beta01

Discussion in 'Centmin Mod Github Commits' started by eva2000, Jul 18, 2016.

  1. eva2000

    eva2000 Administrator Staff Member

    55,163
    12,249
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,825
    Local Time:
    3:18 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    update inc/wpsetup.inc update /root/tools/wp_updater_${vhostname}.sh 123.09beta01

    Official wp-cli docs suggest that wp core update command needs to be run a 2nd time after a wp core update-db command. Also ensure the email for wp update goes through cat -v for properly formatted emails

    Continue reading...


    123.09beta01 branch
     
  2. eva2000

    eva2000 Administrator Staff Member

    55,163
    12,249
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,825
    Local Time:
    3:18 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    For folks who want to update their centmin.sh menu option 22 auto installed wordpress site's cronjob /root/tools/wp_updater_yourdomain.sh scripts, here's the updated base template below.

    Just replace youremaildomain and yourdomain.com with your email address and your domain name in your /root/tools/wp_updater_yourdomain.sh cron script which was auto generated via centmin.sh menu 22 auto wordpress install routines.

    if you only want to auto update wp plugins
    Code (Text):
    #!/bin/bash
    PATH=/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin:/bin
    EMAIL='youremaildomain'
    DT=$(date +"%d%m%y-%H%M%S")
    
    {
    cd /home/nginx/domains/yourdomain.com/public
    echo "/home/nginx/domains/yourdomain.com/public"
    #/usr/bin/wp cli update --allow-root
    echo "update wp-cli"
    rm -rf /usr/bin/wp
    wget -cnv --no-check-certificate https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O /usr/bin/wp --tries=3
    chmod 0700 /usr/bin/wp
    /usr/bin/wp --info --allow-root
    /usr/bin/wp plugin status --allow-root
    /usr/bin/wp plugin update --all --allow-root
    /usr/bin/wp core check-update --allow-root
    #/usr/bin/wp core update --allow-root
    #/usr/bin/wp core update-db --allow-root
    #/usr/bin/wp core update --allow-root
    chown -R nginx:nginx /home/nginx/domains/yourdomain.com/public
    /usr/bin/nprestart
    } 2>&1 | tee /home/nginx/domains/yourdomain.com/log/wp_updater-${DT}.log
    cat -v /home/nginx/domains/yourdomain.com/log/wp_updater-${DT}.log | /usr/bin/tr -cd '\11\12\15\40-\176' | dos2unix | mail -r $EMAIL -s "Wordpress WP-CLI Auto Update $(date)" $EMAIL
    #rm -rf /home/nginx/domains/yourdomain.com/log/wp_updater-${DT}.log
    

    or if you want to auto update wp core + plugins
    Code (Text):
    #!/bin/bash
    PATH=/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin:/bin
    EMAIL='youremaildomain'
    DT=$(date +"%d%m%y-%H%M%S")
    
    {
    cd /home/nginx/domains/yourdomain.com/public
    echo "/home/nginx/domains/yourdomain.com/public"
    #/usr/bin/wp cli update --allow-root
    echo "update wp-cli"
    rm -rf /usr/bin/wp
    wget -cnv --no-check-certificate https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O /usr/bin/wp --tries=3
    chmod 0700 /usr/bin/wp
    /usr/bin/wp --info --allow-root
    /usr/bin/wp plugin status --allow-root
    /usr/bin/wp plugin update --all --allow-root
    /usr/bin/wp core check-update --allow-root
    /usr/bin/wp core update --allow-root
    /usr/bin/wp core update-db --allow-root
    /usr/bin/wp core update --allow-root
    chown -R nginx:nginx /home/nginx/domains/yourdomain.com/public
    /usr/bin/nprestart
    } 2>&1 | tee /home/nginx/domains/yourdomain.com/log/wp_updater-${DT}.log
    cat -v /home/nginx/domains/yourdomain.com/log/wp_updater-${DT}.log | /usr/bin/tr -cd '\11\12\15\40-\176' | dos2unix | mail -r $EMAIL -s "Wordpress WP-CLI Auto Update $(date)" $EMAIL
    #rm -rf /home/nginx/domains/yourdomain.com/log/wp_updater-${DT}.log
    
     
  3. RB1

    RB1 Active Member

    292
    75
    28
    Nov 11, 2016
    California
    Ratings:
    +122
    Local Time:
    10:18 PM
    Nginx 1.21.x
    MariaDB 10.1.x
    Best method to disable WP-CLI email notifications but still auto-update?
    Just comment out "cat -v" command?
    i.e.
     
  4. eva2000

    eva2000 Administrator Staff Member

    55,163
    12,249
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,825
    Local Time:
    3:18 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    if you disable emails, how do you know if update happened in timely manner ?
     
  5. RB1

    RB1 Active Member

    292
    75
    28
    Nov 11, 2016
    California
    Ratings:
    +122
    Local Time:
    10:18 PM
    Nginx 1.21.x
    MariaDB 10.1.x
    I guess I won't really know. Perhaps it would be smarter to just do the cronjob once weekly.
    Getting too many emails is annoying for me :p
     
  6. eva2000

    eva2000 Administrator Staff Member

    55,163
    12,249
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,825
    Local Time:
    3:18 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    filter emails to specific folder or gmail label ;)
     
  7. RB1

    RB1 Active Member

    292
    75
    28
    Nov 11, 2016
    California
    Ratings:
    +122
    Local Time:
    10:18 PM
    Nginx 1.21.x
    MariaDB 10.1.x
    Yeah good point...lol I was going to do that at one point but forgot about it.
    Just made a new Gmail label and filter