Permalink
Browse files

Fixed bug in create_vars.sh and moved variables to seperate file.

There was a bug in create_vars.sh that prevents the creation of a new baseline file. So the patch_set grows over time. This bug was fixed by correcting the typos.

I decided to move all variables to a seperate file and source them in the script create_vars.sh. You could find all varialbes needed in the file variables.txt.example. To use them just copy the file to variables.txt and adjust the values to meet your needs.
  • Loading branch information...
Tronde committed Jul 16, 2018
1 parent 826f50c commit afb40e3c84885f41a063c6e783e09693cda49fda
Showing with 15 additions and 12 deletions.
  1. +1 −0 .gitignore
  2. +3 −12 create_vars.sh
  3. +11 −0 variables.txt.example
View
@@ -4,3 +4,4 @@ patch_set*
vars/main.yml.bak*
vars/main.yml
new_advisories.txt
variables.txt
View
@@ -1,16 +1,7 @@
#!/bin/bash
##############################################################################
# Variables ##################################################################
BASELINE='/data/jka_dev/rhel-patchmanagement/baseline_advisories.txt'
ADVISORIES='/data/jka_dev/rhel-patchmanagement/new_advisories.txt'
CURRENT_PATCH_SET="/data/jka_dev/rhel-patchmanagement/patch_set_`date +%Y-%m-%d.txt`"
VARS='/data/jka_dev/rhel-patchmanagement/vars/main.yml'
MAIL_TEXT='/data/jka_dev/rhel-patchmanagement/mail_text.txt'
MAIL_RCP='rcp@example.com'
DATE1="`date --iso -d '+7 days'`T04:20"
DATE2="`date --iso -d '+14 days'`T04:20"
DATE3="`date --iso -d '+21 days'`T04:20"
DATE4="`date --iso -d '+22 days'`T04:20"
source variables.txt
# Functions ##################################################################
get_advisories() {
@@ -23,7 +14,7 @@ create_patch_set() {
get_advisories >"${BASELINE}" 2>/dev/null
cp "${BASELINE}" "${CURRENT_PATCH_SET}" 2>/dev/null
else
if [ -f ${ADVISORIES}" ] && [ -s ${ADVISORIES}" ]
if [ -f "${ADVISORIES}" ] && [ -s "${ADVISORIES}" ]
then
mv "${ADVISORIES}" "${BASELINE}"
fi
View
@@ -0,0 +1,11 @@
# Variables ##################################################################
BASELINE='/path/to/rhel-patchmanagement/baseline_advisories.txt'
ADVISORIES='/path/to/rhel-patchmanagement/new_advisories.txt'
CURRENT_PATCH_SET="/path/to/rhel-patchmanagement/patch_set_`date +%Y-%m-%d.txt`"
VARS='/path/to/rhel-patchmanagement/vars/main.yml'
MAIL_TEXT='/path/to/rhel-patchmanagement/mail_text.txt'
MAIL_RCP='rcp@example.com'
DATE1="`date --iso -d '+7 days'`T04:20"
DATE2="`date --iso -d '+14 days'`T04:20"
DATE3="`date --iso -d '+21 days'`T04:20"
DATE4="`date --iso -d '+22 days'`T04:20"

0 comments on commit afb40e3

Please sign in to comment.