Learn about Centmin Mod LEMP Stack today
Register Now

Upgrade Centmin Crontab Update?

Discussion in 'Install & Upgrades or Pre-Install Questions' started by Itworx4me, Apr 14, 2019.

  1. Itworx4me

    Itworx4me Premium Member Premium Member

    339
    35
    28
    Mar 14, 2017
    Ratings:
    +65
    Local Time:
    4:12 AM
    Nginx 1.27.4
    MariaDB 10.6.21
    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.11
    • PHP Version Installed: 7.3.4
    • MariaDB MySQL Version Installed: 10.3.14
    • When was last time updated Centmin Mod code base ? : Current
    • Persistent Config: Do you have any persistent config file options set in /etc/centminmod/custom_config.inc ? You can check via this command:
      Code (Text):
      PHP_PGO='y'
      LETSENCRYPT_DETECT='y'
      MENUEXIT_ALWAYS_YUMCHECK='y'
      ENABLE_MARIADBTENTWOUPGRADE='y'
      ENABLE_MARIADBTENTHREEUPGRADE='y'
      DISABLE_IPVSIX='y'
      NGINX_GEOIPTWOLITE='y'
      NGXDYNAMIC_GEOIPTWOLITE='y'
      
      

      When signing onto centmin today I got this message:
      Code (Text):
      # centmin
      /usr/local/src/centminmod ~
      13 23 * * * /usr/local/src/centminmod/tools/autoprotect.sh >/dev/null 2>&1
      0 */4 * * * /usr/bin/cminfo_updater 2>/dev/null

      Looks like it updated the crontab -e. When looking at the crontab -e I see that it deleted everything in there and just left the new updated there:
      Code (Text):
      13 23 * * * /usr/local/src/centminmod/tools/autoprotect.sh >/dev/null 2>&1
      0 */4 * * * /usr/bin/cminfo_updater 2>/dev/null

      This is what was originally there before the update: Sysadmin - SSH Login Slow
      Possible bug? Should the update delete all previous entrys in the crontab?
    Thanks,
    Itworx4me

     
  2. eva2000

    eva2000 Administrator Staff Member

    58,895
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:12 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    it shouldn't have deleted other cronjob setup as the routine that would do the cminfo_updater cronjob setup always includes the existing list of cronjobs in the new configuration
    Code (Text):
    if [[ -z "$(crontab -l 2>&1 | grep cminfo_updater)" ]]; then
        crontab -l > cronjoblist
        echo "0 */4 * * * /usr/bin/cminfo_updater 2>/dev/null" >> cronjoblist
        crontab cronjoblist
        rm -rf cronjoblist
        crontab -l
    fi
    

    which says if output from crontab -l command doesn't contain the word cminfo_updater via grep filter, then output contents of crontab -l and save to file cronjoblist. Then insert the cminfo_updater cronjob command via echo to end of cronjoblist file so that cronjoblist file has all existing crontab -l entries + the new cminfo_updater cronjob line. Then run crontab cronjoblist to register all the cronjoblist entries as cronjobs and then remove that cronjoblist file and then output the newly setup cronjobs via crontab -l.

    So only way for you to have other cronjobs removed is if you removed them yourself or accidentally BEFORE this routine did crontab -l saving to cronjoblist. Which actually makes sense because if you accidentally wiped all cronjobs, then crontab -l command would come back empty and above routine wouln't find cminfo_updater via grep filter, so would trigger that above routine to setup the cminfo_updater cronjob.

    All automatically setup cronjobs have similar logic, if you can't find the line via crontab -l and grep for the expected line, centmin.sh runs will automatically set it up appending to current crontab -l found entries. So centmin.sh never deletes cronjobs, only ever appends to the current cronjob entries listed/outputted from crontab -l command.
     
  3. eva2000

    eva2000 Administrator Staff Member

    58,895
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:12 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    FYI, if you had used centmin.sh menu option 22 to install wordpress, the routine also backups up before and after cronjob entries for safe keeping at /home/nginx/domains/${vhostname}/cronjobs directory where ${vhostname} is your wordpress domain setup via centmin.sh menu option 22. So if you have missing cronjobs you can re-add them from those backups if they exist
     
  4. Itworx4me

    Itworx4me Premium Member Premium Member

    339
    35
    28
    Mar 14, 2017
    Ratings:
    +65
    Local Time:
    4:12 AM
    Nginx 1.27.4
    MariaDB 10.6.21
    Very weird because I never changed or deleted the crontab entry's...