Browse Source

defensive bash

master
jlecour 3 years ago
parent
commit
3664abd6e8
1 changed files with 10 additions and 6 deletions
  1. +10
    -6
      HowtoNagiosChecksWrapper.md

+ 10
- 6
HowtoNagiosChecksWrapper.md View File

@ -33,8 +33,12 @@ Détail du script `alerts_switch` :
set -e
readonly PROGNAME=$(basename $0)
readonly PROGDIR=$(readlink -m $(dirname $0))
readonly ARGS="$@"
usage() {
echo "alerts_switch action prefix"
echo "$PROGNAME action prefix"
}
disable_alerts () {
@ -72,11 +76,11 @@ log_enable () {
}
main () {
readonly action=$1
readonly prefix=$2
local action=$1
local prefix=$2
readonly file_path="/tmp/${prefix}_alerts"
readonly log_file="/var/log/${prefix}_alerts.log"
local file_path="/tmp/${prefix}_alerts"
local log_file="/var/log/${prefix}_alerts.log"
case "$action" in
enable)
@ -97,7 +101,7 @@ main () {
esac
}
main "$@"
main $ARGS
~~~
## (Dés)activation des alertes


Loading…
Cancel
Save