Get the most out of your Centmin Mod LEMP stack
Become a Member

Automatic nightly YUM updates with yum-cron

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

  1. eva2000

    eva2000 Administrator Staff Member

    41,386
    9,297
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,261
    Local Time:
    6:51 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    FYI, if you don't want yum-cron email alerts to be sent from [email protected] 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 = [email protected]
    
    # 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
     
    • Informative Informative x 1
  2. SeaTea

    SeaTea Member

    49
    13
    8
    Feb 20, 2015
    the Netherlands
    Ratings:
    +28
    Local Time:
    10:51 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

    41,386
    9,297
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,261
    Local Time:
    6:51 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    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:
    11:51 AM
    i am not sure if someone else has already asked that
    but cant i use the mail provided by pushover o receive notifications from e-mails?
    instead of the [email protected]
     
  5. eva2000

    eva2000 Administrator Staff Member

    41,386
    9,297
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,261
    Local Time:
    6:51 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    yes you can use pushover email :)
     
    • Like Like x 1
  6. hitman

    hitman Member

    126
    11
    18
    Jul 18, 2014
    Ratings:
    +15
    Local Time:
    11:51 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

    41,386
    9,297
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,261
    Local Time:
    6:51 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    unfortunately centos 7 yum-cron doesn't support that
     
  8. hitman

    hitman Member

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

    eva2000 Administrator Staff Member

    41,386
    9,297
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,261
    Local Time:
    6:51 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    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
    • Winner Winner x 2
  10. Jimmy

    Jimmy Well-Known Member

    1,606
    337
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +847
    Local Time:
    4:51 AM
    1.15.x
    MariaDB 10.3.x
    @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

    41,386
    9,297
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,261
    Local Time:
    6:51 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    centos 6 could but not centos 7 for yum-cron AFAIK
     
  12. Jimmy

    Jimmy Well-Known Member

    1,606
    337
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +847
    Local Time:
    4:51 AM
    1.15.x
    MariaDB 10.3.x
    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

    41,386
    9,297
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,261
    Local Time:
    6:51 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    list yum packages files installed
    Code (Text):
    rpm -ql yum-cron
     
  14. Jimmy

    Jimmy Well-Known Member

    1,606
    337
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +847
    Local Time:
    4:51 AM
    1.15.x
    MariaDB 10.3.x
    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

    41,386
    9,297
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,261
    Local Time:
    6:51 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    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
     
    • Like Like x 4
  16. Jimmy

    Jimmy Well-Known Member

    1,606
    337
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +847
    Local Time:
    4:51 AM
    1.15.x
    MariaDB 10.3.x
    I was hoping there was a work around. Looking forward to your custom yum-cron!
     
    • Like Like x 2
  17. ahmed

    ahmed Member

    243
    19
    18
    Feb 21, 2017
    Ratings:
    +26
    Local Time:
    10:51 AM
    hope to get that too, as mine doesn't autoupdare too
     
  18. pamamolf

    pamamolf Premium Member Premium Member

    3,456
    331
    83
    May 31, 2014
    Ratings:
    +634
    Local Time:
    11:51 AM
    Nginx-1.17.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

    41,386
    9,297
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,261
    Local Time:
    6:51 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    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 Member

    243
    19
    18
    Feb 21, 2017
    Ratings:
    +26
    Local Time:
    10:51 AM
    grep yum.cron /var/log/cron
    shows nothing
    Code:
    [13:40][[email protected] 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