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
|
# If output message should be displayed
|
||||||
[ -z "${OUTPUT_MESSAGE}" ] && OUTPUT_MESSAGE=0
|
[ -z "${OUTPUT_MESSAGE}" ] && OUTPUT_MESSAGE=0
|
||||||
|
|
||||||
|
# APT temp file to monitor
|
||||||
|
readonly APT_TMP_FILE="/tmp/.apt.upgrade"
|
||||||
|
|
||||||
# Maco temp file
|
# Maco temp file
|
||||||
readonly MACO_TMP_FILE="/tmp/.maco.upgrade"
|
readonly MACO_TMP_FILE="/tmp/.maco.upgrade"
|
||||||
readonly MACO_TMP_URGENT_FILE="/tmp/.maco.urgent.upgrade"
|
readonly MACO_TMP_URGENT_FILE="/tmp/.maco.urgent.upgrade"
|
||||||
|
|
||||||
# APT temp file to monitor
|
# Maco status file
|
||||||
readonly APT_TMP_FILE="/tmp/.apt.upgrade"
|
readonly MACO_STATUS_FILE="/var/fr.univ-rennes1.ipr.maco.machinestate.txt"
|
||||||
|
|
||||||
## Colors
|
## Colors
|
||||||
readonly PURPLE='\033[1;35m'
|
readonly PURPLE='\033[1;35m'
|
||||||
|
@ -202,6 +205,36 @@ No Maco upgrade require."
|
||||||
|
|
||||||
return "${return_maco_upgrade_present}"
|
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() { # {{{
|
is_proc_running() { # {{{
|
||||||
|
@ -227,7 +260,7 @@ procs running (with the pattern: ${RED}${local_proc_pattern}${COLOR_DEBUG}) on t
|
||||||
|
|
||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
is_file_present() { # {{{
|
is_file_present() { # {{{
|
||||||
|
|
||||||
local_file_present="${1}"
|
local_file_present="${1}"
|
||||||
|
|
||||||
|
@ -250,7 +283,7 @@ The file ${RED}${local_file_present}${COLOR_DEBUG} doesn't exist."
|
||||||
|
|
||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
is_file_absent() { # {{{
|
is_file_absent() { # {{{
|
||||||
|
|
||||||
local_file_absent="${1}"
|
local_file_absent="${1}"
|
||||||
|
|
||||||
|
@ -406,6 +439,11 @@ main() { # {{{
|
||||||
&& exit 0
|
&& exit 0
|
||||||
fi
|
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 we need to watch for processes
|
||||||
if [ "${CHECK_PROCESS}" -eq "0" ]; then
|
if [ "${CHECK_PROCESS}" -eq "0" ]; then
|
||||||
## If anything related to APT is currently running
|
## If anything related to APT is currently running
|
||||||
|
|
Loading…
Reference in New Issue