Skip to content
Snippets Groups Projects
Commit c642b068 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

some shellfixes; remove grep warnings

parent 5e053ea0
No related branches found
No related tags found
1 merge request!21some shellfixes; remove grep warnings
......@@ -38,7 +38,7 @@
# params string(s) message to log
#
function _log(){
echo "`date` | $*" >> ${logfile}
echo "$(date) | $*" >> "${logfile}"
}
# echo and logging output
......@@ -84,14 +84,14 @@
exit 1
fi
if [ ! -d ${dir_checks} ]; then
if [ ! -d "${dir_checks}" ]; then
echo "ERROR: config dir for checks dir_checks does not exist: $dir_checks"
exit 1
fi
for myconfig in `ls -1 ${dir_checks}/*`
for myconfig in $(ls -1 ${dir_checks}/*)
do
echo ${myconfig}
echo "${myconfig}"
done
}
......@@ -101,7 +101,7 @@
# checkInterval
# param string full path of a config file
function _parseCheckConfig(){
local _myconfig=$1
local _myconfig="$1"
# EXAMPLE a config contains ...
# checkname=check_cronstatus
......@@ -110,11 +110,11 @@
# icon=/images/icon.png
# max_check_attempts=3
checkName=`cat $_myconfig | grep ^checkname= | cut -f 2 -d "=" | sed 's# #_#g'`
checkCommand=`cat $_myconfig | grep ^command= | cut -f 2 -d "="`
checkInterval=`cat $_myconfig | grep ^interval= | cut -f 2 -d "="`
checkIcon=`cat $_myconfig | grep ^icon= | cut -f 2 -d "="`
checkMaxAttempts=`cat $_myconfig | grep ^max_check_attempts= | cut -f 2 -d "="`
checkName=$(cat "$_myconfig" | grep ^checkname= | cut -f 2 -d "=" | sed 's# #_#g')
checkCommand=$(cat "$_myconfig" | grep ^command= | cut -f 2 -d "=")
checkInterval=$(cat "$_myconfig" | grep ^interval= | cut -f 2 -d "=")
checkIcon=$(cat "$_myconfig" | grep ^icon= | cut -f 2 -d "=")
checkMaxAttempts=$(cat "$_myconfig" | grep ^max_check_attempts= | cut -f 2 -d "=")
}
# ======================================================================
......@@ -162,28 +162,28 @@ function _ipf(){
# --- types
'loopback')
_regexInclude='\ scope\ host\ '
_regexInclude=' scope host '
;;
'physical')
_regexExclude="(\ scope\ host\ |\ peer\ |\:vip)"
_regexExclude="( scope host | peer |:vip)"
;;
'virtual')
_regexInclude="\:vip"
_regexInclude=":vip"
;;
'net')
_regexInclude='\ scope\ global\ '
_regexInclude=' scope global '
;;
'peer')
_regexInclude='\ peer\ .*\ scope\ global\ '
_regexInclude=' peer .* scope global '
;;
# --- private/ public ips
'private')
_regexInclude="\ ${_privateranges}.*"
_regexInclude=" ${_privateranges}.*"
;;
'public')
_regexInclude="\ scope\ global\ "
_regexExclude="\ ${_privateranges}\.*"
_regexInclude=" scope global "
_regexExclude=" ${_privateranges}\.*"
;;
# --- output filter
......@@ -253,7 +253,7 @@ function _getIpPrivate(){
fi
_echo "$( http.getResponseHeader )"
_echo $( http.getResponse )
_echo "$( http.getResponse )"
}
......@@ -278,7 +278,7 @@ function _getIpPrivate(){
http.makeRequest GET "${_url}" ""
if [ ! -z "`http.isok`" ]; then
if [ ! -z "$(http.isok)" ]; then
_wd "OK, Object $_url exists - updating cache file $_outfile"
http.responseExport "${_outfile}"
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment