Exit if all SGE queues were manually disabled
This commit is contained in:
parent
47d7060743
commit
fdbc34e5cc
|
@ -136,6 +136,8 @@ ${sge_hostname} is not the current host."
|
|||
|
||||
## List of files to monitor
|
||||
file_nologin_path="/etc/nologin"
|
||||
cluster_dir="/opt/ipr/cluster"
|
||||
sge_queue_flag_pattern="${cluster_dir}/.sge.*.disable"
|
||||
}
|
||||
# }}}
|
||||
is_current_host() { # {{{
|
||||
|
@ -224,25 +226,48 @@ procs running (with the pattern: ${RED}${local_proc_pattern}${COLOR_DEBUG}) on t
|
|||
# }}}
|
||||
is_file_present() { # {{{
|
||||
|
||||
local_file_path="${1}"
|
||||
local_file_present="${1}"
|
||||
|
||||
## File doesn't exist by default
|
||||
return_is_file_present="1"
|
||||
|
||||
### Check if the file exists
|
||||
# shellcheck disable=SC2086
|
||||
if find ${local_file_path} > /dev/null 2>&1; then
|
||||
if find ${local_file_present} > /dev/null 2>&1; then
|
||||
return_is_file_present="0"
|
||||
debug_message "is_file_present − \
|
||||
The file ${RED}${local_file_path}${COLOR_DEBUG} exists."
|
||||
The file ${RED}${local_file_present}${COLOR_DEBUG} exists."
|
||||
else
|
||||
return_is_file_present="1"
|
||||
debug_message "is_file_present − \
|
||||
The file ${RED}${local_file_path}${COLOR_DEBUG} doesn't exist."
|
||||
The file ${RED}${local_file_present}${COLOR_DEBUG} doesn't exist."
|
||||
fi
|
||||
|
||||
return "${return_is_file_present}"
|
||||
|
||||
}
|
||||
# }}}
|
||||
is_file_absent() { # {{{
|
||||
|
||||
local_file_absent="${1}"
|
||||
|
||||
## File exists by default
|
||||
return_is_file_absent="1"
|
||||
|
||||
### Check if the file exists
|
||||
# shellcheck disable=SC2086
|
||||
if find ${local_file_absent} > /dev/null 2>&1; then
|
||||
return_is_file_absent="1"
|
||||
debug_message "is_file_absent − \
|
||||
The file ${RED}${local_file_absent}${COLOR_DEBUG} exists."
|
||||
else
|
||||
return_is_file_absent="0"
|
||||
debug_message "is_file_absent − \
|
||||
The file ${RED}${local_file_absent}${COLOR_DEBUG} doesn't exist."
|
||||
fi
|
||||
|
||||
return "${return_is_file_absent}"
|
||||
|
||||
}
|
||||
# }}}
|
||||
is_queue_enable() { # {{{
|
||||
|
@ -397,6 +422,11 @@ main() { # {{{
|
|||
### Exit
|
||||
is_file_present "${file_nologin_path}" \
|
||||
&& exit 0
|
||||
|
||||
## If all SGE queue(s) were manually disabled
|
||||
### Exit
|
||||
is_file_absent "${sge_queue_flag_pattern}" \
|
||||
|| exit 0
|
||||
fi
|
||||
|
||||
## Simple debug message with color to valid current variables
|
||||
|
|
Loading…
Reference in New Issue