Define extra vars in a function
This commit is contained in:
parent
60c307b933
commit
205207fd15
|
@ -87,6 +87,24 @@ message() { # {{{
|
|||
|
||||
return 0
|
||||
|
||||
}
|
||||
# }}}
|
||||
define_vars() { # {{{
|
||||
|
||||
## If sge_hostname wasn't defined
|
||||
if [ -z "${sge_hostname}" ]; then
|
||||
## Use local host for sge_hostname
|
||||
sge_hostname="$(hostname -f)"
|
||||
fi
|
||||
|
||||
sge_queues_name="$(qhost -h "${sge_hostname:=/dev/null}" -q -xml \
|
||||
| grep "queue name" \
|
||||
| cut -d"'" -f2 )"
|
||||
sge_queues_name_print="$(qhost -h "${sge_hostname:=/dev/null}" -q -xml \
|
||||
| grep "queue name" \
|
||||
| cut -d"'" -f2 \
|
||||
| tr -s '\n' ' ' )"
|
||||
|
||||
}
|
||||
# }}}
|
||||
is_apt_upgrade_present() { # {{{
|
||||
|
@ -256,14 +274,8 @@ Previously disabled by a script (or FORCE is enable), try to enable SGE queue: $
|
|||
# }}}
|
||||
main() { # {{{
|
||||
|
||||
sge_queues_name="$(qhost -h "${sge_hostname:=/dev/null}" -q -xml \
|
||||
| grep "queue name" \
|
||||
| cut -d"'" -f2 )"
|
||||
sge_queues_name_print="$(qhost -h "${sge_hostname:=/dev/null}" -q -xml \
|
||||
| grep "queue name" \
|
||||
| cut -d"'" -f2 \
|
||||
| tr -s '\n' ' ' )"
|
||||
|
||||
## Define all vars according the selected options
|
||||
define_vars
|
||||
|
||||
## If APT package upgrade is available
|
||||
### Exit (wait for APT upgrade to be applied)
|
||||
|
@ -331,9 +343,6 @@ if [ ! "${NBARGS}" -eq "0" ]; then
|
|||
## Switch to the next argument
|
||||
shift
|
||||
manage_arg=$((manage_arg+1))
|
||||
else
|
||||
## Use local host for sge_hostname
|
||||
sge_hostname="$(hostname -f)"
|
||||
fi
|
||||
|
||||
# Parse all options (start with a "-") one by one
|
||||
|
@ -387,9 +396,6 @@ ${RED}${manage_arg}${COLOR_DEBUG} argument(s) successfully managed."
|
|||
else
|
||||
debug_message "Arguments management − \
|
||||
No arguments/options to manage."
|
||||
|
||||
## Use local host for sge_hostname
|
||||
sge_hostname="$(hostname -f)"
|
||||
fi
|
||||
|
||||
# }}}
|
||||
|
|
Loading…
Reference in New Issue