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