Skip to content

Commit

Permalink
always log output to a file
Browse files Browse the repository at this point in the history
This eliminates the risk of losing crucial debug output in a
long mkcloud run because you forgot to redirect to a file and
the terminal/screen/tmux scrollback buffer wasn't big enough.

Closes #1191.
  • Loading branch information
Adam Spiers committed Sep 5, 2016
1 parent 9b6efc1 commit 025d2b1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/mkcloud
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ for required_var in cloud; do
fi
done

: ${log_dir:=/var/log/mkcloud/$cloud}
mkdir -p "$log_dir"
log_file=$log_dir/`date -Iseconds`.log
exec > >(tee -ia $log_file)
exec 2> >(tee -ia $log_file >&2)

if [[ $debug_mkcloud = 1 ]] ; then
set -x
PS4='+(${BASH_SOURCE##*/}:${LINENO}) ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
Expand Down

0 comments on commit 025d2b1

Please sign in to comment.