Check maco status before re-enable SGE queue
This commit is contained in:
parent
3795fcbeea
commit
85c4950d6b
|
@ -11,12 +11,15 @@ readonly NBARGS="${#}"
|
|||
# If output message should be displayed
|
||||
[ -z "${OUTPUT_MESSAGE}" ] && OUTPUT_MESSAGE=0
|
||||
|
||||
# APT temp file to monitor
|
||||
readonly APT_TMP_FILE="/tmp/.apt.upgrade"
|
||||
|
||||
# Maco temp file
|
||||
readonly MACO_TMP_FILE="/tmp/.maco.upgrade"
|
||||
readonly MACO_TMP_URGENT_FILE="/tmp/.maco.urgent.upgrade"
|
||||
|
||||
# APT temp file to monitor
|
||||
readonly APT_TMP_FILE="/tmp/.apt.upgrade"
|
||||
# Maco status file
|
||||
readonly MACO_STATUS_FILE="/var/fr.univ-rennes1.ipr.maco.machinestate.txt"
|
||||
|
||||
## Colors
|
||||
readonly PURPLE='\033[1;35m'
|
||||
|
@ -202,6 +205,36 @@ No Maco upgrade require."
|
|||
|
||||
return "${return_maco_upgrade_present}"
|
||||
|
||||
}
|
||||
# }}}
|
||||
is_maco_status_ok() { # {{{
|
||||
|
||||
## Maco status not ok by default
|
||||
return_maco_status_ok="1"
|
||||
|
||||
## Check if Maco status file is present
|
||||
if [ -f "${MACO_TMP_FILE}" ]; then
|
||||
debug_message "is_maco_status_ok − \
|
||||
Maco status file (${MACO_STATUS_FILE}) exists."
|
||||
local_maco_status=$(grep --max-count=1 -- MacoStatus "${MACO_STATUS_FILE}" | cut --delimiter="=" --fields=2)
|
||||
|
||||
## Check current Maco status
|
||||
if [ "${local_maco_status}" = "last-update-succeeded" ]; then
|
||||
debug_message "is_maco_status_ok − \
|
||||
Last Maco upgrade succeed (${local_maco_status})."
|
||||
return_maco_status_ok="0"
|
||||
else
|
||||
debug_message "is_maco_status_ok − \
|
||||
Maco require upgrade/maintenance (current state: ${local_maco_status})."
|
||||
fi
|
||||
|
||||
else
|
||||
debug_message "is_maco_status_ok − \
|
||||
Maco status file (${MACO_STATUS_FILE}) doesn't exists."
|
||||
fi
|
||||
|
||||
return "${return_maco_status_ok}"
|
||||
|
||||
}
|
||||
# }}}
|
||||
is_proc_running() { # {{{
|
||||
|
@ -406,6 +439,11 @@ main() { # {{{
|
|||
&& exit 0
|
||||
fi
|
||||
|
||||
## If Maco status is ok, CONTINUE
|
||||
### Else Exit (wait for upgrade/maintenance)
|
||||
is_maco_status_ok \
|
||||
|| exit 0
|
||||
|
||||
## If we need to watch for processes
|
||||
if [ "${CHECK_PROCESS}" -eq "0" ]; then
|
||||
## If anything related to APT is currently running
|
||||
|
|
Loading…
Reference in New Issue