readonly et local pour alerts_wrapper
This commit is contained in:
parent
3664abd6e8
commit
fc51eb2f6d
|
@ -127,15 +127,15 @@ Détail du script `alerts_wrapper` :
|
||||||
~~~{.bash}
|
~~~{.bash}
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
check_file="/tmp/$1_alerts_disabled"
|
readonly check_file="/tmp/$1_alerts_disabled"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
check_stdout=$($@)
|
readonly check_stdout=$($@)
|
||||||
check_rc=$?
|
readonly check_rc=$?
|
||||||
|
|
||||||
if [ -e "${check_file}" ]; then
|
if [ -e "${check_file}" ]; then
|
||||||
last_change=$(stat -c %Z "${check_file}")
|
local last_change=$(stat -c %Z "${check_file}")
|
||||||
limit=$(date --date '24 hours ago' +'%s')
|
local limit=$(date --date '24 hours ago' +'%s')
|
||||||
|
|
||||||
if [ ${last_change} -le ${limit} ]; then
|
if [ ${last_change} -le ${limit} ]; then
|
||||||
rm "${check_file}"
|
rm "${check_file}"
|
||||||
|
@ -143,7 +143,7 @@ if [ -e "${check_file}" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "${check_file}" ]; then
|
if [ -e "${check_file}" ]; then
|
||||||
formatted_last_change=$(date --date "@$(stat -c %Z "${check_file}")" +'%c')
|
local formatted_last_change=$(date --date "@$(stat -c %Z "${check_file}")" +'%c')
|
||||||
|
|
||||||
echo "ALERTS DISABLED (since ${formatted_last_change}) - ${check_stdout}"
|
echo "ALERTS DISABLED (since ${formatted_last_change}) - ${check_stdout}"
|
||||||
if [ ${check_rc} = 0 ]; then
|
if [ ${check_rc} = 0 ]; then
|
||||||
|
|
Loading…
Reference in New Issue