A chronological documentation test project, nothing serious, really!

12 Jan 2018 Exclude certain packages from yum-cron (but not from yum)

This is a solution for how you can exclude certain packages being updated when using yum-cron.
Docker and kernel are packages I would like to exclude from yum-cron.

The solution to this is to modify the /etc/yum/yum-cron.conf file adding this to the [base] section


exclude = kernel* docker*

On RHEL6/Centos6 you can use the YUM_PARAMETER to do the same thing

YUM_PARAMETER=kernel* docker*

If you would like to exclude certain packages from yum alltogether you need to modify the affected yum repository.
Example to permanently exclude certain packages like Docker from being updated using the yum command/CLI

Modify /etc/yum.repos.d/redhat.repo

Add the following line under [rhel-7-server-extras-rpms]
exclude = docker*

Before adding a exclude command verify that you add the exclude line under the right repository.

# yum info docker

From repo : rhel-7-server-extras-rpms

Tags: , , , ,

Posted by

09 Jan 2018 Hammer script to get output from Job by id

This is a simple script I use to export the details from a Job run in Red Hat Satellite 6.2 using hammer from the console.

# Redhat Satellite Job query by id using hammer

if [ $1 -eq $1 ] 2>/dev/null; then
# get hosts run by ID
JOBHOSTS=$(hammer job-invocation info –id $1 | sed ‘1,/Hosts/d’ | awk {‘print $2’} | awk ‘NF’)

# Loop hosts
echo “================================================================================
hammer job-invocation output –id $1 –host $HOST
echo “”
echo “You need to type the Job ID”

Tags: , , , ,

Posted by

03 Jan 2018 Print last Sunday of month

This is a bash oneliner to get the date of the last Sunday in the month, nice to have if you cannot figure out an easy solution in crontab.

# cal -m | awk ‘{print $7}’ | grep -E ‘[0-9]’ | tail -n 1

or only using awk
# cal -m | awk ‘$7!=””{l=$7} END {print l}’

The cal command is run using the -m switch to have the first day of week to be Monday.


Posted by