Linux

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 RHEL7/Centos7 [base] … exclude = kernel* docker* On RHEL6/Centos6 you can […]

Read More
Linux

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. #!/bin/bash # 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 | […]

Read More
Linux

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 28 or only using awk # cal -m | awk ‘$7!=””{l=$7} […]

Read More
Linux

Generate IP-address ranges using simple bash script

This is just a simple script to generate IP-addresses in a IP-range and write the result output to a file. The script does also remove addresses you would like to exclude from the final output. #!/bin/bash OUTFILE=”mk-iprange.txt” IPRANGE=”192.168.0 192.168.1″ EXCLUDE=”192.168.0.1 192.168.0.2 192.168.1.1″ # Remove old OUTFILE rm -f $OUTFILE # Loop addresses, write to OUTFILE […]

Read More