From caa2d1e3abd3e978f1a77917b1b35ba58bebc33b Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Thu, 21 Dec 2023 11:27:33 +0100
Subject: [PATCH] fiy typo

---
 check_backup_one        | 149 ----------------------------------------
 check_iml_backup_server |   4 +-
 2 files changed, 2 insertions(+), 151 deletions(-)
 delete mode 100755 check_backup_one

diff --git a/check_backup_one b/check_backup_one
deleted file mode 100755
index 9427730..0000000
--- a/check_backup_one
+++ /dev/null
@@ -1,149 +0,0 @@
-#!/bin/bash
-# ======================================================================
-#
-# Check IML BACKUP SERVER
-#
-# requires access to storage_helper.sh
-# in /opt/imlbackup/server/
-#
-# ----------------------------------------------------------------------
-# 2020-07-27  v0.x  <axel.hahn@iml.unibe.ch>
-# 2023-12-20  v0.2  <axel.hahn@iml.unibe.ch>
-# 2023-12-21  v1.0  <axel.hahn@iml.unibe.ch>  first version
-# ======================================================================
-
-
-. $(dirname $0)/inc_pluginfunctions
-export self_APPVERSION=1.0
-
-sInstalldir=/opt/imlbackup/server
-sScript=storage_helper.sh
-sMode=
-
-# ----------------------------------------------------------------------
-# FUNCTIONS
-# ----------------------------------------------------------------------
-
-function showHelp(){
-    local _self; _self=$(basename $0)
-    cat <<EOF
-$( ph.showImlHelpHeader )
-
-Show status of backup server.
-You can get the count of connections or the status of server backup.
-
-See https://os-docs.iml.unibe.ch/iml-backup-server/
-
-SYNTAX:
-$_self [-d DIRECTORY] -m MODE
-
-OPTIONS:
-    -h or --help   show this help.
-    -d or --dir    set installation dir of iml deployment to find its check skript
-                   default dir: ${sInstalldir}
-                   script: ${sInstalldir}/${sScript}
-    -m or --mode   mode: set type of result; one of status|backupstatus
-                     backupstatus  status of backup sets of all servers
-                     status        count of connected servers
-
-EXAMPLE:
-$_self -m status 
-$_self -m backupstatus 
-
-EOF
-}
-
-function _getServerOfStatus(){
-    local _key="$1"
-    local _data="$2"
-    grep "$_key .*| [0-9].* |" <<< "$_data"
-}
-
-function _getStatusCount(){
-    _getServerOfStatus "$1" "$2" | wc -l
-}
-# ----------------------------------------------------------------------
-# MAIN
-# ----------------------------------------------------------------------
-
-# --- check param -h
-while [[ "$#" -gt 0 ]]; do case $1 in
-    -h|--help)      showHelp; exit 0;;
-    -d|--dir)       sInstalldir=$2; shift ;shift;;
-    -m|--mode)      sMode=$2;
-                    shift ;shift
-                    if ! grep -E "^(status|backupstatus)$" <<< "$sMode" >/dev/null; then
-                        ph.abort "ERROR: unknown mode [$sMode]."
-                    fi
-                    ;;
-    *) echo "ERROR: Unknown parameter: $1"; showHelp; exit 1;
-esac; done
-
-if [ -z "$sMode" ]; then
-    ph.abort "ERROR: The mode was not set. Use parameter -m for it. Get help wit -h."
-fi
-
-myscript="$sInstalldir/$sScript"
-
-if [ ! -x "$myscript" ]; then
-    ph.abort "UNKNOWN: $myscript is not available / executable. Use -d to fix the installation dir. Get help wit -h."
-fi
-
-# --- read data
-data=$( "$myscript" "$sMode" )
-
-case "$sMode" in
-    "backupstatus")
-        typeset -i iTotal;   iTotal=$(  grep "^total : " <<< "$data" | cut -f 2 -d ":" | awk '{ print $1 }' )
-        typeset -i iErrors;  iErrors=$( grep "^errors: " <<< "$data" | cut -f 2 -d ":")
-
-        typeset -i iOK;         iOK=$(         _getStatusCount "\." "$data" )
-        typeset -i iNotStarted; iNotStarted=$( _getStatusCount "\?" "$data")
-        typeset -i iDisable;    iDisable=$(    _getStatusCount "D"  "$data" )
-        typeset -i iRunning;    iRunning=$(    _getStatusCount "R"  "$data")
-
-        if [ $iErrors -gt 0 ]; then
-            ph.setStatus critical
-        fi
-        if [ $iNotStarted -eq $iTotal ]; then
-            ph.setStatus unknown
-        fi
-        ph.status "Server Backups - $iTotal servers in backup - $iErrors errors - $iDisable disbled - $iRunning running"
-        echo List of server backups grouped by status
-        echo
-        (
-            # draw 1st line with table header
-            echo "$data" | grep "server.*start.*end"
-            echo
-
-            # show servers grouped by status
-            for mystatus in E D R "\?" D "\."
-            do
-                _getServerOfStatus "$mystatus" "$data"
-            done
-            echo -e "\e[0m"
-            echo "$data" | grep "server.*start.*end"
-            echo
-        ) | tr '|' ':'
-
-        ph.perfadd "notstarted"   "${iNotStarted}"   "" "" 0 $iTotal
-        ph.perfadd "disabled"     "${iDisable}"      "" "" 0 $iTotal
-        ph.perfadd "ok"           "${iOK}"           "" "" 0 $iTotal
-        ph.perfadd "running"      "${iRunning}"      "" "" 0 $iTotal
-        ph.perfadd "error"        "${iErrors}"       "" "" 0 $iTotal
-        ;;
-    "status")
-        typeset -i iRunning; iRunning=$( grep "STATUS" <<< "$data" | cut -f 2 -d " ")
-        typeset -i iMax;     iMax=$(     grep "STATUS" <<< "$data" | cut -f 8 -d " " | tr -d '.')
-
-        # --- status output
-        ph.status "Backups running: $iRunning (max $iMax)"
-        # echo "$data"
-
-        ph.perfadd "running"   "${iRunning}"   "" "" 0 $iMax
-        ;;
-esac
-
-ph.exit
-
-# ----------------------------------------------------------------------
diff --git a/check_iml_backup_server b/check_iml_backup_server
index 9427730..7c36a7b 100755
--- a/check_iml_backup_server
+++ b/check_iml_backup_server
@@ -80,13 +80,13 @@ while [[ "$#" -gt 0 ]]; do case $1 in
 esac; done
 
 if [ -z "$sMode" ]; then
-    ph.abort "ERROR: The mode was not set. Use parameter -m for it. Get help wit -h."
+    ph.abort "ERROR: The mode was not set. Use parameter -m for it. Get help with -h."
 fi
 
 myscript="$sInstalldir/$sScript"
 
 if [ ! -x "$myscript" ]; then
-    ph.abort "UNKNOWN: $myscript is not available / executable. Use -d to fix the installation dir. Get help wit -h."
+    ph.abort "UNKNOWN: $myscript is not available / executable. Use -d to fix the installation dir. Get help with -h."
 fi
 
 # --- read data
-- 
GitLab