allow output to STDOUT via cmdline
This commit is contained in:
@@ -8,6 +8,7 @@ SCRIPT_NAME="$(basename "${0}")"
|
|||||||
GIT_REPO_BRANCH="${GIT_REPO_BRANCH:-production}"
|
GIT_REPO_BRANCH="${GIT_REPO_BRANCH:-production}"
|
||||||
OIC_FLAG="--only-if-changed"
|
OIC_FLAG="--only-if-changed"
|
||||||
VERBOSE_FLAG="--verbose"
|
VERBOSE_FLAG="--verbose"
|
||||||
|
DEBUG_FLAG="false"
|
||||||
|
|
||||||
# - Process command line
|
# - Process command line
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
@@ -16,6 +17,11 @@ while [ $# -gt 0 ]; do
|
|||||||
echo "Usage: $0 [--branch <branch name>]"
|
echo "Usage: $0 [--branch <branch name>]"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
-d|--debug)
|
||||||
|
VERBOSE_FLAG="-vvvv"
|
||||||
|
DEBUG_FLAG="true"
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
-b|--branch)
|
-b|--branch)
|
||||||
shift 1
|
shift 1
|
||||||
if [ $# -eq 0 ] ; then echo "${SCRIPT_NAME}: ERROR - Branch not specified." ; exit 1 ; fi
|
if [ $# -eq 0 ] ; then echo "${SCRIPT_NAME}: ERROR - Branch not specified." ; exit 1 ; fi
|
||||||
@@ -23,12 +29,12 @@ while [ $# -gt 0 ]; do
|
|||||||
shift 1
|
shift 1
|
||||||
;;
|
;;
|
||||||
-f|--force)
|
-f|--force)
|
||||||
shift 1
|
|
||||||
OIC_FLAG=""
|
OIC_FLAG=""
|
||||||
|
shift 1
|
||||||
;;
|
;;
|
||||||
-q|--quiet)
|
-q|--quiet)
|
||||||
shift 1
|
|
||||||
VERBOSE_FLAG=""
|
VERBOSE_FLAG=""
|
||||||
|
shift 1
|
||||||
;;
|
;;
|
||||||
--)
|
--)
|
||||||
shift 1
|
shift 1
|
||||||
@@ -61,8 +67,12 @@ if ! flock -n 9 ; then
|
|||||||
exit 11
|
exit 11
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# - Append all further STDOUT and STDERR to the log file
|
# - If debugging requested or running from a terminal . . .
|
||||||
exec >>"${LOG_FILE}" 2>&1
|
if [ "${DEBUG_FLAG}" = "true" || test -t 1 ] ; 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
|
||||||
|
fi
|
||||||
|
|
||||||
# - Log that we've gotten this far
|
# - Log that we've gotten this far
|
||||||
echo
|
echo
|
||||||
|
|||||||
Reference in New Issue
Block a user