Disable SGE queue only if sge_execd is absent
This commit is contained in:
parent
2340ced9b8
commit
1279e28e83
|
@ -329,6 +329,32 @@ procs running (with the pattern: ${RED}${local_proc_pattern}${COLOR_DEBUG}) on t
|
|||
|
||||
return "${return_proc_running}"
|
||||
|
||||
}
|
||||
# }}}
|
||||
is_proc_absent() { # {{{
|
||||
|
||||
local_proc_pattern="${1}"
|
||||
|
||||
## Proc is absent by default
|
||||
return_proc_absent="0"
|
||||
|
||||
local_count_proc_pattern="$(pgrep -f -- "${local_proc_pattern}" | wc -l)"
|
||||
|
||||
case "${local_count_proc_pattern}" in
|
||||
0 ) ## No procs related to this pattern are running
|
||||
return_proc_absent="0"
|
||||
;;
|
||||
* ) ## At least one proc seems running
|
||||
return_proc_absent="1"
|
||||
;;
|
||||
esac
|
||||
|
||||
## Simple debug message to valid current variables
|
||||
debug_message "is_proc_absent − \
|
||||
procs running (with the pattern: ${RED}${local_proc_pattern}${COLOR_DEBUG}) on the current host: ${RED}${local_count_proc_pattern}${COLOR_DEBUG}."
|
||||
|
||||
return "${return_proc_absent}"
|
||||
|
||||
}
|
||||
# }}}
|
||||
is_file_present() { # {{{
|
||||
|
@ -527,22 +553,18 @@ main() { # {{{
|
|||
|
||||
## If we need to watch for processes
|
||||
if [ "${CHECK_PROCESS}" -eq "0" ]; then
|
||||
## Ensure the SGE queue(s) are really disable without creation of any flag file
|
||||
sh "${sge_disable_host_queue_script}" --force
|
||||
|
||||
## Wait few seconds
|
||||
sleep "${sleep_delay}"
|
||||
|
||||
## If nothing related to SGE is currently running {{{
|
||||
### First ensure that SGE queue(s) are really disable without creation of any flag file
|
||||
### Wait few seconds
|
||||
### Try to start the SGE execd systemd service
|
||||
### Exit with error if the service can't start
|
||||
is_proc_running "${sge_proc_pattern}" \
|
||||
|| systemctl --quiet start sge_execd.service > /dev/null 2>&1 \
|
||||
|| exit 4
|
||||
### Wait few seconds
|
||||
is_proc_absent "${sge_proc_pattern}" \
|
||||
&& sh "${sge_disable_host_queue_script}" --force \
|
||||
&& sleep "${sleep_delay}" \
|
||||
&& systemctl --quiet start sge_execd.service > /dev/null 2>&1 \
|
||||
&& sleep "${sleep_delay}"
|
||||
## }}}
|
||||
|
||||
## Wait few seconds
|
||||
sleep "${sleep_delay}"
|
||||
fi
|
||||
|
||||
## If we need to watch for upgrades
|
||||
|
|
Loading…
Reference in New Issue