This commit is contained in:
2026-08-21 18:56:36 -05:00
parent 76d0fe843a
commit 5e0d333c7b
2 changed files with 15 additions and 5 deletions
+4 -5
View File
@@ -54,21 +54,20 @@ GIT_REPO_BASE="https://gitea.admin-a.hpetersenfamily.com/heath/ansible"
GIT_REPO="${GIT_REPO_BASE}.git"
# - Include ansible virtual environment (in case not already done - we don't know how we're being run)
VIRTUAL_ENV_DISABLE_PROMPT=true
. "${VENV_ACTIVATE_SCRIPT}"
# - If we can't get a lock, don't proceed
if ! exec 9>"${LOCK_FILE}" ; then
echo "${SCRIPT_NAME}: ERROR - Unable to open the lock file (${LOCK_FILE})! Exiting..." >&2
echo "${SCRIPT_NAME}: ERROR - Unable to open the lock file (${LOCK_FILE})! Exiting..." >&2
exit 10
fi
if ! flock -n 9 ; then
echo "${SCRIPT_NAME}: ERROR - Another copy is already running! Exiting..." >&2
echo "${SCRIPT_NAME}: ERROR - Another copy is already running! Exiting..." >&2
exit 11
fi
# - If debugging requested or running from a terminal . . .
if [ "${DEBUG_FLAG}" = "true" || test -t 1 ] ; then
if [ "${DEBUG_FLAG}" = "true" ] || test -t 0 ; then
exec > >(tee -a "${LOG_FILE}") 2>&1 # - send STDOUT and STDERR to both STDOUT and the log file
else
exec >>"${LOG_FILE}" 2>&1 # - send STDOUT and STDERR to the log file only
@@ -76,7 +75,7 @@ fi
# - Log that we've gotten this far
echo
echo "${SCRIPT_NAME}: $(date "+%Y-%m-%d %H:%M:%S") ----------------------------------------"
echo "${SCRIPT_NAME}: ------------------------------- $(date "+%Y-%m-%d %H:%M:%S") -------------------------------"
# - Do our work
ansible-pull ${OIC_FLAG} ${VERBOSE_FLAG} --url "${GIT_REPO}" --checkout "${GIT_REPO_BRANCH}" "${@}"
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
send_some_output() {
echo "hello"
echo "here"
echo "goodbye"
}
exec > >(tee -a ./x.out) 2>&1
send_some_output >&2