Manage case if file isn't readable or unknown status
This commit is contained in:
parent
bff4b528fa
commit
c6c1fd2bd0
|
@ -216,8 +216,8 @@ No Maco urgent update is planned."
|
|||
# Verify the status of last Maco update
|
||||
check_last_update_status() {
|
||||
|
||||
## Check if Maco status file is present
|
||||
if [ -f "${MACO_STATUS_FILE}" ]; then
|
||||
## Check if Maco status file is present and readable
|
||||
if [ -r "${MACO_STATUS_FILE}" ]; then
|
||||
debug_message "check_last_update_status − \
|
||||
Maco status file (${MACO_STATUS_FILE}) exists."
|
||||
local_maco_status=$(grep --max-count=1 -- MacoStatus "${MACO_STATUS_FILE}" | cut --delimiter="=" --fields=2)
|
||||
|
@ -239,12 +239,15 @@ Maco status file (${MACO_STATUS_FILE}) exists."
|
|||
elif [ "${local_maco_status}" = "last-update-failed" ]; then
|
||||
echo "${RED_PIC} Last Maco update failed (MacoStatus=${local_maco_status})." >> "${PLUGIN_RESULT}"
|
||||
echo "12${RED_PIC} Maco update failed" >> "${PLUGIN_STATE}"
|
||||
else
|
||||
echo "${CLEAR_PIC} Maco last update status is unknown (MacoStatus=${local_maco_status})." >> "${PLUGIN_RESULT}"
|
||||
echo "42${CLEAR_PIC} Maco last update status is unknown" >> "${PLUGIN_STATE}"
|
||||
fi
|
||||
else
|
||||
debug_message "check_last_update_status − \
|
||||
Maco status file (${MACO_STATUS_FILE}) doesn't exists."
|
||||
…
|
||||
echo "42${CLEAR_PIC} Maco last update status is unknow (${MACO_STATUS_FILE} doesn't exists or isn't available)." >> "${PLUGIN_STATE}"
|
||||
echo "${CLEAR_PIC} Maco last update status is unknown (${MACO_STATUS_FILE} doesn't exists or isn't available)." >> "${PLUGIN_RESULT}"
|
||||
echo "44${CLEAR_PIC} Maco last update status is unknown" >> "${PLUGIN_STATE}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue