mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-20 01:02:36 +01:00
deprecate parallel mode
This commit is contained in:
@@ -93,54 +93,6 @@ warn() {
|
||||
echo -e "${COLOR_YELLOW}$*${COLOR_RESET}"
|
||||
}
|
||||
|
||||
# This function checks and adds any error code
|
||||
# that is not "0" to the tmp file
|
||||
bastille_check_exit_code() {
|
||||
|
||||
local jail="${1}"
|
||||
local exit_code="${2}"
|
||||
|
||||
# Set exit code variable
|
||||
if [ -z "${TMP_BASTILLE_EXIT_CODE}" ]; then
|
||||
error_exit "[ERROR]: Exit code status not set."
|
||||
else
|
||||
local old_exit_code="$(cat ${TMP_BASTILLE_EXIT_CODE})"
|
||||
fi
|
||||
|
||||
if [ "${exit_code}" -ne 0 ]; then
|
||||
local new_exit_code="$(( ${old_exit_code} + ${exit_code} ))"
|
||||
echo "${new_exit_code}" > "${TMP_BASTILLE_EXIT_CODE}"
|
||||
error_notify "[ERROR CODE]: ${exit_code}"
|
||||
fi
|
||||
}
|
||||
|
||||
# This needs to be the last function called
|
||||
# if used on any command
|
||||
bastille_return_exit_code() {
|
||||
|
||||
local exit_code="$(cat ${TMP_BASTILLE_EXIT_CODE})"
|
||||
|
||||
rm -f ${TMP_BASTILLE_EXIT_CODE}
|
||||
return "${exit_code}"
|
||||
}
|
||||
|
||||
# Parallel mode, don't exceed process limit
|
||||
bastille_running_jobs() {
|
||||
|
||||
_process_limit="${1}"
|
||||
_running_jobs=$((_running_jobs + 1))
|
||||
|
||||
if [ "${_running_jobs}" -ge "${_process_limit}" ]; then
|
||||
|
||||
# Wait for at least one process to finish
|
||||
wait 2>/dev/null || wait
|
||||
|
||||
_running_jobs=$((_running_jobs - 1))
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
check_target_exists() {
|
||||
local _TARGET="${1}"
|
||||
local _jaillist="$(bastille list jails)"
|
||||
|
||||
Reference in New Issue
Block a user