backend/satellite_tools/accounts/satpasswd | 2 -
backend/satellite_tools/accounts/satwho | 2 -
backend/satellite_tools/rhn-db-stats | 2 -
client/tools/spacewalk-koan/spacewalkkoan/spacewalkkoan.py | 2 -
projects/oracle-server-scripts/create-db.sh | 2 -
projects/ssl-cert-check/rhn-ssl-cert-check | 25 +------------
scripts/create-dump-dir.sh | 2 -
web/modules/dobby/scripts/check-oracle-space-usage.sh | 4 +-
8 files changed, 11 insertions(+), 30 deletions(-)
New commits:
commit 3d71a55b88fe3a2302fec699e054c7fdcbc8ef0c
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 28 15:40:05 2009 +0200
awk | sed | sed is rarely needed
diff --git a/web/modules/dobby/scripts/check-oracle-space-usage.sh
b/web/modules/dobby/scripts/check-oracle-space-usage.sh
index d479653..f0964c5 100755
--- a/web/modules/dobby/scripts/check-oracle-space-usage.sh
+++ b/web/modules/dobby/scripts/check-oracle-space-usage.sh
@@ -34,7 +34,7 @@ contact Red Hat Support for assistance."
exit 0
}
#grab the usage numbers from the db-control report output
-NUMBERS=`reportusage | awk '{print $5}'|sed '1d'| sed 's/%//g'`
+NUMBERS=`reportusage | awk '{if (FNR > 1) {sub("%",""); print
$5}}'`
# run db-control and then use awk and sed to get the % numbers
for num in $NUMBERS
do
commit 4efa223a4d8b335a512a0a40e7596fdc8d721ca4
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 28 15:39:29 2009 +0200
use spacewalk-cfg-get instead of awk
diff --git a/web/modules/dobby/scripts/check-oracle-space-usage.sh
b/web/modules/dobby/scripts/check-oracle-space-usage.sh
index 7bbfe9a..d479653 100755
--- a/web/modules/dobby/scripts/check-oracle-space-usage.sh
+++ b/web/modules/dobby/scripts/check-oracle-space-usage.sh
@@ -20,7 +20,7 @@ reportusage() {
mailitout() {
#get Satellite email address
- MAILADDRESS=`awk '/traceback_mail/ {print $3}' /etc/rhn/rhn.conf`
+ MAILADDRESS=$(spacewalk-cfg-get traceback_mail)
SUBJECT="Warning - high tablespace usage on Satellite oracle DB"
commit 13e26582753b8bc3c61e2074819c9527e095f13d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 28 15:21:53 2009 +0200
grep | awk is rarely needed
diff --git a/scripts/create-dump-dir.sh b/scripts/create-dump-dir.sh
index 49a2d52..8beefe8 100755
--- a/scripts/create-dump-dir.sh
+++ b/scripts/create-dump-dir.sh
@@ -17,7 +17,7 @@ URL=$1
echo "Downloading from $URL"
echo "Fetching iso list"
-wget -o /dev/null $URL -O - | grep iso | awk -F '"' '{print $6}'
> $ISOLIST
+wget -o /dev/null $URL -O - | awk -F '"' '/iso/ {print $6}' >
$ISOLIST
NUM=`cat $ISOLIST | wc -l`
echo "Found $NUM disc images"
commit df40ce0fea378d8a74a471ff89276b611329b5b1
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 28 15:19:36 2009 +0200
grep | awk is rarely needed
diff --git a/projects/ssl-cert-check/rhn-ssl-cert-check
b/projects/ssl-cert-check/rhn-ssl-cert-check
index b625ba9..ce59b9f 100644
--- a/projects/ssl-cert-check/rhn-ssl-cert-check
+++ b/projects/ssl-cert-check/rhn-ssl-cert-check
@@ -43,7 +43,7 @@ REMOTE_HOSTS=/etc/sysconfig/rhn/ssl-hosts.conf
# Return path to the SSL certificate
get_ssl_cert_file() {
- grep ^SSLCertificateFile $SSL_HTTPD_CONF_FILE | awk '{print $2}'
+ awk '/^SSLCertificateFile/ {print $2}' $SSL_HTTPD_CONF_FILE
}
# main
commit 74130524baef82a532a1dcb0c41dedeb6d186de6
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 28 15:16:55 2009 +0200
use spacewalk-cfg-get instead of awk
diff --git a/projects/ssl-cert-check/rhn-ssl-cert-check
b/projects/ssl-cert-check/rhn-ssl-cert-check
index b89fbcb..b625ba9 100644
--- a/projects/ssl-cert-check/rhn-ssl-cert-check
+++ b/projects/ssl-cert-check/rhn-ssl-cert-check
@@ -41,34 +41,15 @@ REMOTE_HOSTS=/etc/sysconfig/rhn/ssl-hosts.conf
[ -z "$ADMIN" -a ! -f $RHN_CONF_FILE ] && exit 0
-# Retrieve a setting from rhn.conf
-get_rhn_conf() {
- local component="$1"
- local conf="$2"
- grep "^$conf" $RHN_CONF_FILE | awk -F= '{print $2}'
-}
-
# Return path to the SSL certificate
get_ssl_cert_file() {
grep ^SSLCertificateFile $SSL_HTTPD_CONF_FILE | awk '{print $2}'
}
-get_rhn_component() {
- # Identify the RHN component
- if rpm -q spacewalk-proxy-management >& /dev/null; then
- echo "proxy.broker"
- return
- elif rpm -q spacewalk-java >& /dev/null; then
- echo "server.satellite"
- return
- fi
-}
-
# main
-component=$(get_rhn_component)
-if [ -z "$ADMIN" -a -n "$component" ]; then
- ADMIN=$(get_rhn_conf $component traceback_mail)
+if [ -z "$ADMIN" ]; then
+ ADMIN=$(spacewalk-cfg-get traceback_mail)
# Replace commas with spaces
ADMIN=${ADMIN//,/ }
# Trim leading spaces
commit 6faeac9f43f29d265a252c93f29a97f1c1ae70ab
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 28 15:01:21 2009 +0200
grep | awk is rarely needed
diff --git a/projects/oracle-server-scripts/create-db.sh
b/projects/oracle-server-scripts/create-db.sh
index b53c8b5..459f283 100755
--- a/projects/oracle-server-scripts/create-db.sh
+++ b/projects/oracle-server-scripts/create-db.sh
@@ -150,7 +150,7 @@ function CheckSpace() {
template=$1
# use m4 magic to determine how much space we will need...
ReqFactor=$(m4 -DRHNORA_CALC_SPACE $(m4_macros $DB_NAME) $template)
- AvailSpace=$(df -P $DataDB | grep ^/dev/ | awk '{ print $4 }')
+ AvailSpace=$(df -P $DataDB | awk '/^\/dev\// { print $4 }')
ReqSpace=$(($ReqFactor * 1024 * 120 / 100))
if [ $ReqSpace -gt $AvailSpace ] ; then
echo "ERROR: Not have enough free space on $DataDB"
commit 0bc5c97620d537dfa8134470e2041b96272369bb
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 28 14:58:49 2009 +0200
grep | awk is rarely needed
diff --git a/client/tools/spacewalk-koan/spacewalkkoan/spacewalkkoan.py
b/client/tools/spacewalk-koan/spacewalkkoan/spacewalkkoan.py
index d5f7e50..f8a143c 100644
--- a/client/tools/spacewalk-koan/spacewalkkoan/spacewalkkoan.py
+++ b/client/tools/spacewalk-koan/spacewalkkoan/spacewalkkoan.py
@@ -61,7 +61,7 @@ def find_name_servers():
return ret
def find_gateway():
- response = execute("route -n | grep '^0.0.0.0' | awk '{print
$2}'")
+ response = execute("route -n | awk '/^0\.0\.0\.0/ {print $2}'")
return response[0]
def getSystemId():
commit c1e8d1fd8322a435ec9e86a753f1ae69aac40761
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 28 14:47:42 2009 +0200
use spacewalk-cfg-get instead of awk
diff --git a/backend/satellite_tools/accounts/satpasswd
b/backend/satellite_tools/accounts/satpasswd
index a975f8f..ed13ad5 100755
--- a/backend/satellite_tools/accounts/satpasswd
+++ b/backend/satellite_tools/accounts/satpasswd
@@ -12,7 +12,7 @@ SQLPLUS=/usr/bin/sqlplus
SATWHO=/usr/bin/satwho
MD5=/usr/bin/openssl
MD5ARGS="passwd -1 -stdin"
-CREDENTIALS=$(awk -F= '/^default_db/ {print $2} ' /etc/rhn/rhn.conf)
+CREDENTIALS=$(spacewalk-cfg-get default_db)
PROG=satpasswd
myuser=""
diff --git a/backend/satellite_tools/accounts/satwho
b/backend/satellite_tools/accounts/satwho
index c6ba02d..9beb039 100755
--- a/backend/satellite_tools/accounts/satwho
+++ b/backend/satellite_tools/accounts/satwho
@@ -9,7 +9,7 @@
# script within RHN Satellite and an embedded database.
SQLPLUS=/usr/bin/sqlplus
-CREDENTIALS=$(awk -F= '/^default_db/ {print $2} ' /etc/rhn/rhn.conf)
+CREDENTIALS=$(spacewalk-cfg-get default_db)
if [ ! -x $SQLPLUS ]
then
diff --git a/backend/satellite_tools/rhn-db-stats b/backend/satellite_tools/rhn-db-stats
index da6165b..a90073b 100755
--- a/backend/satellite_tools/rhn-db-stats
+++ b/backend/satellite_tools/rhn-db-stats
@@ -5,7 +5,7 @@ if [ $# -lt 1 -o $# -gt 2 ]; then
exit
fi
-CONNECT=$(awk '/default_db/ {split($0,a,"="); print a[2]}'
/etc/rhn/rhn.conf)
+CONNECT=$(spacewalk-cfg-get default_db)
[ -n "$2" ] && CONNECT=$2
# sqlplus ... | cat > ... is here to fool selinux, since oracle_sqlplus_t
Show replies by date