Welcome to Centmin Mod Community
Register Now

Automatic nightly YUM updates with yum-cron for CentOS 7 Only

Discussion in 'System Administration' started by eva2000, Sep 28, 2014.

  1. eva2000

    eva2000 Administrator Staff Member

    54,052
    12,176
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,734
    Local Time:
    10:07 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    FYI, if you don't want yum-cron email alerts to be sent from root@yourhostname.domain.com but from a different address, you can.


    For CentOS 7 has another option in /etc/yum/yum-cron.conf for email_from field
    Code:
    [email]
    # The address to send email messages from.
    email_from = root@localhost
    
    # List of addresses to send messages to.
    email_to = root
    
    # Name of the host to connect to to send email messages.
    email_host = localhost
    on CentOS 6 version of yum-cron no such native email from option but you can probably hack the file at /etc/cron.daily/0yum.cron near the end
    Code:
    if [ ! -z "$MAILTO" ] && [ -x /bin/mail ]; then
    # if MAILTO is set, use mail command (ie better than standard mail with cron output)
      [ -s "$YUMTMP" ] && mail -s "System update: $SYSTEMNAME" $MAILTO < $YUMTMP
    else
    # default behavior is to use cron's internal mailing of output from cron-script
      cat $YUMTMP
    fi 
    the section
    Code:
    mail -s "System update: $SYSTEMNAME" $MAILTO
    can add -r EMAILFROMADDR, so if you wanted to send from same address as to address already filled out
    Code:
    mail -r $MAILTO -s "System update: $SYSTEMNAME" $MAILTO
     
  2. SeaTea

    SeaTea Member

    49
    13
    8
    Feb 20, 2015
    the Netherlands
    Ratings:
    +28
    Local Time:
    1:07 AM
    Nginx:1.11
    MariaDB-10
    hmmm this bug seems at last been fixed in yum-3.4.3-138.el7 , however my (updated) Centos-7 centmin server seems to have yum 3.4.3-132.el7 according 'yum info yum'. Can we force it to update yum to this later version somehow ?
     
  3. eva2000

    eva2000 Administrator Staff Member

    54,052
    12,176
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,734
    Local Time:
    10:07 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    need to wait for CentOS / RHEL 7.3 which according to that bug report is due in a few months, when it get's closer to 7.3 beta, it should be available in centos continuous release repo or even fasttrack as well
    Code (Text):
    yum list updates -q --enablerepo=fasttrack,cr --disableplugin=priorities
    
     
  4. hitman

    hitman Member

    126
    11
    18
    Jul 18, 2014
    Ratings:
    +15
    Local Time:
    2:07 AM
  5. eva2000

    eva2000 Administrator Staff Member

    54,052
    12,176
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,734
    Local Time:
    10:07 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yes you can use pushover email :)
     
  6. hitman

    hitman Member

    126
    11
    18
    Jul 18, 2014
    Ratings:
    +15
    Local Time:
    2:07 AM
    also another question please
    for the beta09 version dont i have to adjust the yum update with the
    "--disableplugin=priorities --enablerepo=remi"
    ?
     
  7. eva2000

    eva2000 Administrator Staff Member

    54,052
    12,176
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,734
    Local Time:
    10:07 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    unfortunately centos 7 yum-cron doesn't support that
     
  8. hitman

    hitman Member

    126
    11
    18
    Jul 18, 2014
    Ratings:
    +15
    Local Time:
    2:07 AM
    does Centos 6 yum-cron support it?
     
  9. eva2000

    eva2000 Administrator Staff Member

    54,052
    12,176
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,734
    Local Time:
    10:07 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yeah seems to in centos 6 yum-cron config file at /etc/sysconfig/yum-cron it has YUM_PARAMETER which takes yum parameters

    example to exclude MariaDB* packages from yum-cron
    Code (Text):
    # Pass any given paramter to yum, as run in all the scripts invoked
    # by this package.  Be aware that this is global, and yum is invoked in
    # several modes by these scripts for which your own parameter might not
    # be appropriate
    YUM_PARAMETER="-x MariaDB*"

    On CentOS 6 yum-cron, you can maybe try
    Code (Text):
    # Pass any given paramter to yum, as run in all the scripts invoked
    # by this package.  Be aware that this is global, and yum is invoked in
    # several modes by these scripts for which your own parameter might not
    # be appropriate
    YUM_PARAMETER="--disableplugin=priorities --enablerepo=remi -x MariaDB*"


    FYI, for a long time now I have been writing on my own custom version of yum-cron for centmin mod auto yum updates seeing as yum-cron is just a bash script :) I should look at rolling it out eventually and it should support both --disableplugin=priorities and --enablerepo= flags :)
     
    Last edited: Nov 6, 2016
  10. Jimmy

    Jimmy Well-Known Member

    1,788
    390
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +990
    Local Time:
    7:07 PM
    @eva2000 is there somewhere that users could add a new update type? Meaning the below "What kind of update to use" the update_cmd has to call from somewhere. Would it be possible to add # centmin mod update = --disableplugin=priorities --enablerepo=remi,city-fan.org to the list below?

    I tried to search around but couldn't find anywhere that those commands are called from. It would be great if a new one could be added with covered the specific needs for CMM.

    Maybe it's not possible, just wanted to throw it out there.

    Code:
    [commands]
    #  What kind of update to use:
    # default                            = yum upgrade
    # security                           = yum --security upgrade
    # security-severity:Critical         = yum --sec-severity=Critical upgrade
    # minimal                            = yum --bugfix update-minimal
    # minimal-security                   = yum --security update-minimal
    # minimal-security-severity:Critical =  --sec-severity=Critical update-minimal
    update_cmd = default
    
     
  11. eva2000

    eva2000 Administrator Staff Member

    54,052
    12,176
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,734
    Local Time:
    10:07 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    centos 6 could but not centos 7 for yum-cron AFAIK
     
  12. Jimmy

    Jimmy Well-Known Member

    1,788
    390
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +990
    Local Time:
    7:07 PM
    I'm trying to search online again. There has to be some file which says:

    When update_cmd = minimal-security run yum --security update-minimal if we could find that file, we could add one for CMM.
     
  13. eva2000

    eva2000 Administrator Staff Member

    54,052
    12,176
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,734
    Local Time:
    10:07 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    list yum packages files installed
    Code (Text):
    rpm -ql yum-cron
     
  14. Jimmy

    Jimmy Well-Known Member

    1,788
    390
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +990
    Local Time:
    7:07 PM
    Looks like the update_cmd is in /usr/sbin/yum-cron but it doesn't have the specific output listed on the commands list. If it did, it would probably be easy to add a new entry.
     
  15. eva2000

    eva2000 Administrator Staff Member

    54,052
    12,176
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,734
    Local Time:
    10:07 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yeah centos 7 version of yum-cron went backwards compared centos 6 yum-cron for supported features. That's why i am working on a custom yum-cron like script tool for Centmin Mod which will more extensive to support all Centmin Mod installed or available yum repos :D
     
  16. Jimmy

    Jimmy Well-Known Member

    1,788
    390
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +990
    Local Time:
    7:07 PM
    I was hoping there was a work around. Looking forward to your custom yum-cron!
     
  17. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    2:07 AM
    hope to get that too, as mine doesn't autoupdare too
     
  18. pamamolf

    pamamolf Premium Member Premium Member

    4,074
    427
    83
    May 31, 2014
    Ratings:
    +833
    Local Time:
    2:07 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    Hope to get that as an option as I prefer to do that manually :)
     
  19. eva2000

    eva2000 Administrator Staff Member

    54,052
    12,176
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,734
    Local Time:
    10:07 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Yeah not ready at my end for my version so for CentOS 7 users you can also setup your own cronjob if you really need for such.
     
  20. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    2:07 AM
    grep yum.cron /var/log/cron
    shows nothing
    Code:
    [13:40][root@servername username]# ls -lahrt /var/log | grep cron
    -rw-------   1 root           root           452K May  8 10:37 cron-20170508
    -rw-------   1 root           root           291K May 14 06:02 cron-20170514
    -rw-------   1 root           root           361K May 21 08:21 cron-20170521
    -rw-------   1 root           root           394K May 29 05:34 cron-20170529
    -rw-------   1 root           root            17K May 29 13:40 cron