diff --git a/about b/about index 93d0fb8847fe62700a87aeaf35eabcf1d441a293..0bea24abf0596340552f142c24b46175b0fc54aa 100755 --- a/about +++ b/about @@ -29,7 +29,7 @@ export self_APPVERSION=1.3 # show help text function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_apache_requests b/check_apache_requests index 6bed6cd39a7754cde34fc4c9f9dd98d69bc31bd4..ce7b506a73fca66ca1c2e5d297b65b5ff29b936f 100755 --- a/check_apache_requests +++ b/check_apache_requests @@ -44,7 +44,7 @@ paramsWget="-T 5 -t 1 --no-check-certificate" # ---------------------------------------------------------------------- function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_ceph_diskfree b/check_ceph_diskfree index 3a3b72cd39772d5b5e602d126cf289ef4b6c8b05..ec012bcc4b625100fa67a36d1d7f1313b87f051b 100755 --- a/check_ceph_diskfree +++ b/check_ceph_diskfree @@ -35,7 +35,7 @@ typeset -i iCritical=0 function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) @@ -45,7 +45,8 @@ This check sends performance data. It uses 'ceph df' to parse data. SYNTAX: -$(basename $0) + + $_self OPTIONS: -h or --help show this help. diff --git a/check_ceph_io b/check_ceph_io index 9dc42561c9e8b267664ada5cb02b9b70afc004eb..b0dc78e05ab996c2c4333b94c97732bae7719f79 100755 --- a/check_ceph_io +++ b/check_ceph_io @@ -29,7 +29,7 @@ export self_APPVERSION=1.6 function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_ceph_osd b/check_ceph_osd index 7b604219231b2354cb3d02199f2711518b3d655f..cac24b1c2722012793a53af509d7f4ebca5c0602 100755 --- a/check_ceph_osd +++ b/check_ceph_osd @@ -44,7 +44,7 @@ iColUpDown=5 # ---------------------------------------------------------------------- function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_ceph_status b/check_ceph_status index 0e2e8c763b4a064aae8d6ee210dbb9c362f956d0..480b5be9dbbc33459bc77ee612c8f234448fd646 100755 --- a/check_ceph_status +++ b/check_ceph_status @@ -47,7 +47,7 @@ line="__________________________________________________________________________ # ---------------------------------------------------------------------- function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_clientbackup b/check_clientbackup index 834d04d7bb531fb35137af35dddb4c91da600fc8..075be12ae76654b09f8ccfa435ab095df7c42b87 100755 --- a/check_clientbackup +++ b/check_clientbackup @@ -34,7 +34,7 @@ sInstalldir=/opt/imlbackup/client/ # ---------------------------------------------------------------------- function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_couchdb b/check_couchdb index 02da514ae823054e791ae4c0261c06c8edfd9fd6..d6fd7d9ede1c02dc0f89775e4386d9eed7ee0c57 100755 --- a/check_couchdb +++ b/check_couchdb @@ -41,7 +41,7 @@ NL=" # show help function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_cpu b/check_cpu index d5da20c54b7d860eae52ff3fbf3b87d578d355d2..652935c16dc5575507dd8d06e9ab667a1c39393e 100755 --- a/check_cpu +++ b/check_cpu @@ -48,7 +48,8 @@ On higher cpu usage it can show processes that cause cpu waits and with most cpu consumption. SYNTAX: -$(basename $0) [-w WARN_LIMIT] [-c CRITICAL_LIMIT] [-i CRITICAL_IO_WAIT] [-p PROCESS_LIMIT] + + $_self [-w WARN_LIMIT] [-c CRITICAL_LIMIT] [-i CRITICAL_IO_WAIT] [-p PROCESS_LIMIT] OPTIONS: @@ -67,7 +68,8 @@ PARAMETERS: None. EXAMPLE: -$(basename $0) -w 60 -c 80 -p 40 + + $_self -w 60 -c 80 -p 40 EOF } diff --git a/check_cronstatus b/check_cronstatus index 86e56fb6f1f8d549165ec7b292c41e7c7b20a392..2a1c63facc44152c429d7b9796579fdff036dd9c 100755 --- a/check_cronstatus +++ b/check_cronstatus @@ -42,7 +42,7 @@ statusScript=/opt/cronwrapper/cronstatus.sh # ---------------------------------------------------------------------- function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) @@ -55,7 +55,8 @@ The last run of each job is verified to these conditions: SYNTAX: -$(basename $0) [-h] [SCRIPT] + + $_self [-h] [SCRIPT] OPTIONS: diff --git a/check_deployment b/check_deployment index ff12d380878110fd6751eb98669bcea7cd916ffb..98c7ff5fa60f055051ad75a91463376403afdb40 100755 --- a/check_deployment +++ b/check_deployment @@ -20,7 +20,7 @@ sInstalldir=/opt/imldeployment-installer # ---------------------------------------------------------------------- function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_disk-io b/check_disk-io index f0de5eab04b8482879e933305bc853a599f94264..4e4c6cba57cbb2b3cdb84b7f895bec48e9d81e3a 100755 --- a/check_disk-io +++ b/check_disk-io @@ -46,7 +46,7 @@ function getDisks(){ # show help function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_dns_responsetime b/check_dns_responsetime index c184b218dbc01e1f80f94e18afdfadc2861c1548..3194a198b5a34593f23dacfa3d14d92f558ce22d 100755 --- a/check_dns_responsetime +++ b/check_dns_responsetime @@ -39,7 +39,7 @@ typeset -i iNotReachable=0 # show help function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_docker_info b/check_docker_info index 46c63633f88c3ec56c68db8a89e9d5b20772b4a1..8f936a2a9540f61d08f2524c1f1d1f4b17ff40cd 100755 --- a/check_docker_info +++ b/check_docker_info @@ -34,7 +34,7 @@ self_APPVERSION=1.6 # show help function _showHelp(){ - local _self=$( basename $0 ) + local _self; _self="$( basename "$0" )" cat <<EOH $( ph.showImlHelpHeader ) diff --git a/check_docker_io b/check_docker_io index a755fb9893955e874fce0e1861d4cfaf2f0f8128..a352515931bbeb666f057768f6ebd2156f39fd48 100755 --- a/check_docker_io +++ b/check_docker_io @@ -32,7 +32,7 @@ typeset -i iSpeedTrans # show help function _showHelp(){ - local _self=$( basename $0 ) + local _self; _self="$( basename "$0" )" cat <<EOH $( ph.showImlHelpHeader ) diff --git a/check_docker_stats b/check_docker_stats index 357900bf6f55797dcbb138aa7a20538cc137f8c6..6e69f49dc835308712ebca349453e36a96c9e7a1 100755 --- a/check_docker_stats +++ b/check_docker_stats @@ -31,7 +31,7 @@ self_APPVERSION=1.2 # show help function _showHelp(){ - local _self=$( basename $0 ) + local _self; _self="$( basename "$0" )" cat <<EOH $( ph.showImlHelpHeader ) diff --git a/check_dockercontainer_info b/check_dockercontainer_info index 0ae798b65befc5729abe364424ec77034076ee6c..f5a8c00da57c84c271dfa6b59ae921e9145fe237 100755 --- a/check_dockercontainer_info +++ b/check_dockercontainer_info @@ -29,7 +29,7 @@ self_APPVERSION=1.1 # show help function _usage(){ - local _self=$( basename $0 ) + local _self; _self="$( basename "$0" )" cat <<EOH $( ph.showImlHelpHeader ) diff --git a/check_dockercontainer_top b/check_dockercontainer_top index 39a3e297eadc077001f11c405c638c2dd93bd741..7a22ed53d914a45d197b246968f3e00d7c923cb3 100755 --- a/check_dockercontainer_top +++ b/check_dockercontainer_top @@ -30,7 +30,7 @@ self_APPVERSION=1.2 # show help function _showHelp(){ - local _self=$( basename $0 ) + local _self; _self="$( basename "$0" )" cat <<EOH $( ph.showImlHelpHeader ) diff --git a/check_eol b/check_eol index 7b8f2acec4faccf574ba188261036f50b43ebd46..9e421f07959f1fd047edaef67f54e5730167e1cb 100755 --- a/check_eol +++ b/check_eol @@ -142,7 +142,7 @@ function findEolDate(){ } function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_file_age b/check_file_age index dca372ae3359976880cefb88f3960eb3b2b639ab..27debf2bb1b3b70f125c876c02101bc6a08cb6eb 100755 --- a/check_file_age +++ b/check_file_age @@ -34,7 +34,7 @@ typeset -i iLimitCritical=14 # show help text function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_fs_errors b/check_fs_errors index 12e95c57a8150f8e2bbc912f4aefd009e4da2c2e..6ae65a72935e25abe9dba62804d91dbd6f55ad21 100755 --- a/check_fs_errors +++ b/check_fs_errors @@ -26,7 +26,7 @@ export self_APPVERSION=1.4 # ---------------------------------------------------------------------- function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_fs_writable b/check_fs_writable index c7cb842b9c0ae19a6ab141b5f4456a88536fe087..58b3bb0f463888cddd4794e240317eac7e866b14 100755 --- a/check_fs_writable +++ b/check_fs_writable @@ -8,7 +8,7 @@ # # ---------------------------------------------------------------------- # 2021-03-23 v0.0 <axel.hahn@iml.unibe.ch> -# 2023-07-27 v1.1 <axel.hahn@unibe.ch> shell fixes; update help page +# 2023-07-27 v1.1 <axel.hahn@unibe.ch> shell fixes; update help page # 2025-02-10 v1.2 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== @@ -25,7 +25,7 @@ out="" # ---------------------------------------------------------------------- function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_gitlab_tokens b/check_gitlab_tokens index 6e382c3a4c707271bafb7b22f55e547664067e96..8366b19c5f4f6dbe3ab7c6593b5594a3819b62da 100755 --- a/check_gitlab_tokens +++ b/check_gitlab_tokens @@ -54,7 +54,7 @@ output="" # Show help function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_haproxy_health b/check_haproxy_health index 4621a4173ac8871407b22eb3eb1fa0ddee7127d3..a0d2398112f3efb0d5cc9fbd5dbec33143ea5bdb 100755 --- a/check_haproxy_health +++ b/check_haproxy_health @@ -29,7 +29,7 @@ tmpfile=/tmp/check_haproxy_healthcheck_$$ # ---------------------------------------------------------------------- function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_haproxy_status b/check_haproxy_status index 5fa15d72d52874c53e2cd561fa542d76a3266d79..d7c9cd638b924ee2b1af44cbd7f19111fb05463e 100755 --- a/check_haproxy_status +++ b/check_haproxy_status @@ -69,7 +69,7 @@ function checkStatus(){ # show help function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_http b/check_http index 8b88fb87685fecc341643a18e2fd2a36f26f9bed..47cc9d5fd0212f5178ebc50f4132f72438251067 100755 --- a/check_http +++ b/check_http @@ -22,7 +22,7 @@ export self_APPVERSION=1.1 # show help text function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_iml_backup_server b/check_iml_backup_server index db61e351701a9faf5e755f3e6430a99c83d9581d..48c8ccea3fb30b142c6703839b4ace213455c28d 100755 --- a/check_iml_backup_server +++ b/check_iml_backup_server @@ -30,7 +30,7 @@ sMode= # show help function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_journallog b/check_journallog index 04d2729ed0fb8a2423b0a89a0fbe43fe90491556..b73d76b3a2bfe5664f8fcafef110d982410f333f 100755 --- a/check_journallog +++ b/check_journallog @@ -26,7 +26,7 @@ tmpfile=/tmp/last_journallog_line_${USER}.txt # show help text function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_memory b/check_memory index f8f4928288be64120df848e909aa279d7371f63b..e075494b83227435067ba69bc3806199b16267bf 100755 --- a/check_memory +++ b/check_memory @@ -48,7 +48,7 @@ function getMemvalue(){ # show help text function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) @@ -59,7 +59,8 @@ be shown. This plugin sends performancedata. SYNTAX: -$(basename $0) [-w WARN_LIMIT] [-c CRITICAL_LIMIT] [-s SWAP_LIMIT] [-p PROCESS_LIMIT] [-h] + + $_self [-w WARN_LIMIT] [-c CRITICAL_LIMIT] [-s SWAP_LIMIT] [-p PROCESS_LIMIT] [-h] OPTIONS: -w VALUE Warning level for RAM usage [%]; default: 75 @@ -76,7 +77,8 @@ PARAMETERS: none EXAMPLE: -$(basename $0) -w 90 -c 95 -p 70 + + $_self -w 90 -c 95 -p 70 EOF } diff --git a/check_mysqlserver b/check_mysqlserver index 8a6997535c12431ecfb1ca0dcd8d82ce9e23d5a4..d33f88ea208af3bff994a76d506e7b2b3756fba3 100755 --- a/check_mysqlserver +++ b/check_mysqlserver @@ -105,7 +105,7 @@ EOF # show help text function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) @@ -240,7 +240,7 @@ fi # --- check installation if ! grep $myuser $cfgfile >/dev/null 2>&1; then - ph.abort "MYSQL access not possible yet. You need to install the monitoring user first: as root execute $(basename $0) -i" + ph.abort "MYSQL access not possible yet. You need to install the monitoring user first: as root execute $(basename "$0" ) -i" fi # ---------------------------------------------------------------------- diff --git a/check_netio b/check_netio index 20134be49508d0ab15472180cb57d07138312404..37eb4f01caa7e4a4ee3b74d17ada2ecaa33cd170 100755 --- a/check_netio +++ b/check_netio @@ -36,7 +36,7 @@ nonPhysicalInterfaces="(lo|bond.*|cali.*|docker.*|flannel.*|ppp.*|veth.*):" # show help text function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_netstat b/check_netstat index c1274c921ec0abb4f81ceadc5b9a78a5377382de..45c4405eef835f59a3dde56c26670700fd1e1fc8 100755 --- a/check_netstat +++ b/check_netstat @@ -23,7 +23,7 @@ export self_APPVERSION=1.3 # ---------------------------------------------------------------------- function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_onehost b/check_onehost index b36af13ceda6ff83d81b5b5de3b12cc9e4d8f811..ba795fc0978e9a2bf99e69284edc1df224b487bd 100755 --- a/check_onehost +++ b/check_onehost @@ -25,7 +25,7 @@ self_APPVERSION=1.5 # ---------------------------------------------------------------------- function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_onevm b/check_onevm index d15fdcda506c9a23c8114a580bb4d72897f603f3..8cafccfcc0710e501d0f7352d3e658b2a66daeb3 100755 --- a/check_onevm +++ b/check_onevm @@ -59,7 +59,7 @@ showData=0 # ---------------------------------------------------------------------- function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_opencpu b/check_opencpu index ace024e378b1cdef47c022a5ae11600765c608af..d36fb32c61bf3e99baf1cf4a8c05d185d1bc30f8 100755 --- a/check_opencpu +++ b/check_opencpu @@ -46,7 +46,7 @@ paramsWget="-T 5 -t 1 --no-check-certificate" # show help text function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_packages2install b/check_packages2install index 2281f93c6e8573491f3323691edf80de81d2d572..3c8551d11c7b2d837637b96bcba77efb95f1d9c8 100755 --- a/check_packages2install +++ b/check_packages2install @@ -41,8 +41,8 @@ typeset -i iCount=0 cronfile=/etc/cron.d/system-updater MYhost="localhost" -dir_pkg="$( dirname $0 )/check_packages2install-pkgmanager" -dir_filter="$( dirname $0 )/check_packages2install-data" +dir_pkg="$( dirname "$0" )/check_packages2install-pkgmanager" +dir_filter="$( dirname "$0" )/check_packages2install-data" # ---------------------------------------------------------------------- # functions @@ -84,8 +84,7 @@ function _functionExists(){ # show help function showHelp(){ - local _self - _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_php-fpm-status b/check_php-fpm-status index c00576e936a62fcc62ca7b3d1795205fbecc7b65..0903d17f3281692bc40f6b28591916d7f71211bc 100755 --- a/check_php-fpm-status +++ b/check_php-fpm-status @@ -71,7 +71,7 @@ function _getvalue(){ function showHelp(){ - local _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_proc_mem b/check_proc_mem index 00b62121ab9d76979f1f9206fede0332a60c3449..4e11749e188f3284d9de111fd4a88e61884f6235 100755 --- a/check_proc_mem +++ b/check_proc_mem @@ -37,7 +37,7 @@ typeset -i iCountCritical=0 # show help text function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_psqlserver b/check_psqlserver index 3fa00e4896f7faa4cbd35a4e4cd53ece5bc69fb1..f44d163f42e9beb04b494e0144b29142de9fa470 100755 --- a/check_psqlserver +++ b/check_psqlserver @@ -49,7 +49,7 @@ function _queryFailed(){ ph.setStatus "unknown" echo "UNKNOWN: the database query failed" echo "Quick troubleshooter:" - echo "* install a database user $myuser with command $(basename $0) -i" + echo "* install a database user $myuser with command $( basename "$0" ) -i" echo "* check pg_hba.conf login fails if it set to ident (eg. change it to md5)" ph.exit } @@ -213,7 +213,7 @@ fi # --- check installation if ! grep $myuser $cfgfile >/dev/null 2>&1; then - ph.abort "PSQL access not possible yet. You need to install the monitoring user first: as root execute `basename $0` -i" + ph.abort "PSQL access not possible yet. You need to install the monitoring user first: as root execute $( basename "$0" ) -i" fi . "${cfgfile}" diff --git a/check_smartstatus b/check_smartstatus index 7af6668d7e55ad35e0d2c528e03b476ca218bf46..cb19fa92349c283df840c25b888e3c2cac5fab87 100755 --- a/check_smartstatus +++ b/check_smartstatus @@ -62,14 +62,14 @@ export PATH # show help function showHelp(){ - local self=$( basename $0 ) + local _self; _self="$( basename "$0" )" cat <<EOH $( ph.showImlHelpHeader ) Show status of local S.M.A.R.T. devices. SYNTAX: - $self [-h] [-l] [devices] + $_self [-h] [-l] [devices] OPTIONS: @@ -80,10 +80,10 @@ PARAMETERS: EXAMPLES - $self + $_self Scan all local disks - $self -l + $_self -l List all local disks without scanning them. EOH diff --git a/check_snmp_data b/check_snmp_data index f1ba7d0e24c22dac275f2e3d35cb846c970fad40..33874a211ecaaeb3fcdfd13ccf0efc140eec4cee 100755 --- a/check_snmp_data +++ b/check_snmp_data @@ -154,8 +154,8 @@ _isinteger(){ #--------------------------------------------------- # --- show usage function showHelp(){ - _self=$( basename $0 ) - local _methods=$( + local _self; _self="$( basename "$0" )" + local _methods; methods=$( _cfg_getMethods | while read -r line do METHOD=$(echo "$line" | cut -f 2 -d ":") diff --git a/check_snmp_printer b/check_snmp_printer index 3506a891d5a5b924bdf3e1d69ad08d1c8869f6b5..9a178dfca087876acf847f247011bef65cfc2850 100755 --- a/check_snmp_printer +++ b/check_snmp_printer @@ -21,7 +21,7 @@ # shellcheck source=/dev/null . "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. "$( dirname $0 )/check_snmp_includes" || exit 1 +. "$( dirname "$0" )/check_snmp_includes" || exit 1 self_APPVERSION=1.1 @@ -40,7 +40,7 @@ esac #--------------------------------------------------- # --- show usage function showHelp(){ - _self=$( basename $0 ) + local _self; _self="$( basename "$0" )" cat <<EOH $( ph.showImlHelpHeader ) diff --git a/check_snmp_synology b/check_snmp_synology index 23baedada0229a18bf4dee208216e86f6e817c73..f5d92d474b279a0e42f243206368914e0b85302e 100755 --- a/check_snmp_synology +++ b/check_snmp_synology @@ -72,7 +72,7 @@ FLAG_DISK=1 FLAG_UPDATE=1 FLAG_TEMPERATURE=1 -_self=$( basename $0 ) +_self="$( basename "$0" )" USAGE="$( ph.showImlHelpHeader ) Check health of a Synology drive using SNMP. diff --git a/check_ssl b/check_ssl index f162278d59803a72b8814db310471524a533a6c9..b408c366aa965840458f18a8613764c20f90b66e 100755 --- a/check_ssl +++ b/check_ssl @@ -41,7 +41,7 @@ sStatus= # show help with syntax function showHelp(){ - _self=$( basename $0 ) + local _self; _self="$( basename "$0" )" cat <<EOH $( ph.showImlHelpHeader ) diff --git a/check_ssl_certs b/check_ssl_certs index 4b2197cba212f7543ac6541fd6520852e46cb7b1..a10f0802ea32283d558b8ab453ac5c9e53ee9c96 100755 --- a/check_ssl_certs +++ b/check_ssl_certs @@ -43,7 +43,7 @@ myDomain=".iml.unibe.ch" # show help text function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) @@ -51,7 +51,8 @@ Check locally installed SSL client certificates and warn if the expiration date comes closer. SYNTAX: -$(basename $0) [-w WARN_LIMIT] [-c CRITICAL_LIMIT] [-f "FILELIST"] + + $_self [-w WARN_LIMIT] [-c CRITICAL_LIMIT] [-f "FILELIST"] OPTIONS: @@ -70,11 +71,11 @@ PARAMETERS: EXAMPLE: - $(basename $0) -f "/etc/ssl/certs/*example.com.*.cer /somewhere/else/*.cer" + $_self -f "/etc/ssl/certs/*example.com.*.cer /somewhere/else/*.cer" Set 2 folders where to find the client certificates. They are seperated by space and both use * for globbing - $(basename $0) -w 30 -c 3 + $_self -w 30 -c 3 Overide the warning and critical level. EOF diff --git a/check_systemdservices b/check_systemdservices index 6acd6e986d12ff5d20a330ba575a8885222f1dbf..4a7deed57c3666ed1218ad89f0388f83ba4179f1 100755 --- a/check_systemdservices +++ b/check_systemdservices @@ -31,10 +31,10 @@ self_APPVERSION=1.5 cfgfile="$0.cfg" ignorefile="$0.ignore" -tmpServices=/tmp/`basename $0`-services.txt -tmpErrors=/tmp/`basename $0`-errors.txt -tmpOut=/tmp/`basename $0`-out.txt -tmpOutOther=/tmp/`basename $0`-out-other.txt +tmpServices="/tmp/$( basename "$0" )-services.txt" +tmpErrors=/tmp/$( basename "$0" )-errors.txt +tmpOut=/tmp/$( basename "$0" )-out.txt +tmpOutOther=/tmp/$( basename "$0" )-out-other.txt typeset -i iErrors=0 typeset -i iOk=0 diff --git a/check_systemdunit b/check_systemdunit index 8a57587aa39ca22e902d427d80c2aa271b8bf292..9dd9971f64c1cbe7ce9fc10d0c8f72f5200383be 100755 --- a/check_systemdunit +++ b/check_systemdunit @@ -26,7 +26,7 @@ export self_APPVERSION=1.8 # show help text function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_timesync b/check_timesync index cdef18f79bf86d4166212c7f7837d1707ec457e3..4a2ffe7086266df37b396b84e218514de3290140 100755 --- a/check_timesync +++ b/check_timesync @@ -33,7 +33,7 @@ tmpfile=/tmp/check_timesync.tmp # show help text function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_uptime b/check_uptime index 9442f2c06721e52276d5ba0aa3d9288ddded437b..4a7d851ff639f909be9ec56c662911ec98bbdfbf 100755 --- a/check_uptime +++ b/check_uptime @@ -35,7 +35,7 @@ self_APPVERSION=1.6 # show help text function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/docs/30_Shared_functions/inc_pluginfunctions.md b/docs/30_Shared_functions/inc_pluginfunctions.md index d504796110f85817ee4d9d2455e1231b8797cc54..7ccfc500bf7aee5d1556716f1c5e6408d90ccf6f 100644 --- a/docs/30_Shared_functions/inc_pluginfunctions.md +++ b/docs/30_Shared_functions/inc_pluginfunctions.md @@ -3,7 +3,7 @@ All scripts start with sourcing a shared bash file ```shell -. $( dirname $0 )/inc_pluginfunctions +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 ``` In that script are several functions starting with prefix **ph.** (=plugin helper) diff --git a/hello b/hello index df489865cdba0a4a25ef89bd4701eb4684fbf8d2..78a5efb576b79ac4c7f75e11f48bff3140f619ea 100755 --- a/hello +++ b/hello @@ -18,7 +18,7 @@ self_APPVERSION=1.1 # show help text function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/inc_pluginfunctions b/inc_pluginfunctions index bd102868d63e60471980f9a045f5292a1166e6b8..528fc7c67d430e10eee1d5cfe5ace6e3f533419d 100644 --- a/inc_pluginfunctions +++ b/inc_pluginfunctions @@ -373,7 +373,7 @@ function ph._getStorefile(){ local mydir="/tmp/icinga_counter_${USER}" test -n "$dir_data" && mydir="${dir_data}/_counter_${USER}" local _basename - _basename=$(basename $0) + _basename="$( basename "$0" )" test -d "${mydir}" || mkdir -p "${mydir}" echo "${mydir}/${_basename}${varName}.lastvalue" @@ -417,7 +417,7 @@ function ph._readlastvalue(){ # it creates a filename based on the started check script function ph._perfinit(){ local _basename - _basename=$(basename $0) + _basename="$( basename "$0" )" ph_perfdatafile="/tmp/perfdata_$(echo $_basename | sed "s#[^a-z0-9\-]#_#g")" rm -f "${ph_perfdatafile}" 2>/dev/null } @@ -578,12 +578,12 @@ function ph.execIfReady(){ # including a link to the online help ph.showImlHelpHeader(){ local _html; - _html=$(basename $0) + _html="$( basename "$0" )" _html=${_html//\-/_}.html cat <<EOF ______________________________________________________________________ -$( basename $0 | tr [:lower:] [:upper:] ) +$( basename "$0" | tr [:lower:] [:upper:] ) v$self_APPVERSION (c) Institute for Medical Education - University of Bern