Description of problem: The check-oracle-space-usage.sh calls su - oracle -c "db-control report" and then processes its output. However, it seems some users have settings in /etc/profile or other logon files that lead to some extra output being returned by that su command. That in turns breaks our postprocessing awk '{print $5}'|sed '1d'| sed 's/%//g' and leads to errors since non-numeric data appears on the output. Version-Release number of selected component (if applicable): rhn-dobby-5.0.1-10 How reproducible: Deterministic if you have something in /etc/profile. Steps to Reproduce: 1. Add "echo Test" to your /etc/profile. 2. Run /etc/cron.daily/check-oracle-space-usage.sh Actual results: # /etc/cron.daily/check-oracle-space-usage.sh /etc/cron.daily/check-oracle-space-usage.sh: line 42: [: Use: integer expression expected Expected results: No error, the script should be robust enough to work even in this case. Additional info: See the thread at https://www.redhat.com/mailman/private/rhn-satellite-users/2007-December/msg00044.html The post at https://www.redhat.com/mailman/private/rhn-satellite-users/2007-December/msg00068.html suggests using awk '/[0-9]%$/ {gsub("%", ""); print $NF}' Which seems good enough.
BTW -- don't forget to remove that "echo Test" from your /etc/profile when you're done with this bug.
Colin C.Coe noted in private email that it might be worth only processing those lines ending with % sign that follow a line with "Tablespaces". That way, if user's have some mess in their .bash_profiles ... A cow orker has his .bash_profile output how full (in %) of the shared /scratch. The original awk DoesTheWrongThing(tm) if there is a line of output the ends with a number and % sign as the last things on the line before the actual output of 'db-control report'. The below awk doesn't print anything unless it has already seen a line starting with 'Tablespace'. ... we'll only process the correct lines.
Fixed in Spacewalk repo, commit a091b99a1121ba2bcaf1415e0dd2eb47beed39a2. I've ended up calling runuser without -, so that /etc/profile and ~/.bash_profile are not read at all.
With compose Satellite-5.3.0-RHEL5-re20090220.1 available, moving ON_QA.
Verified on Satellite-5.3.0-RHEL5-re20090220.1. ~SayliK
Verified in stage -> RELEASE_PENDING
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHEA-2009-1434.html