Merge "Rename screen logfiles"
This commit is contained in:
commit
256b8234a9
@ -1278,8 +1278,8 @@ function _run_process {
|
|||||||
exec 6>&-
|
exec 6>&-
|
||||||
|
|
||||||
if [[ -n ${SCREEN_LOGDIR} ]]; then
|
if [[ -n ${SCREEN_LOGDIR} ]]; then
|
||||||
exec 1>&${SCREEN_LOGDIR}/screen-${service}.${CURRENT_LOG_TIME}.log 2>&1
|
exec 1>&${SCREEN_LOGDIR}/screen-${service}.log.${CURRENT_LOG_TIME} 2>&1
|
||||||
ln -sf ${SCREEN_LOGDIR}/screen-${service}.${CURRENT_LOG_TIME}.log ${SCREEN_LOGDIR}/screen-${service}.log
|
ln -sf ${SCREEN_LOGDIR}/screen-${service}.log.${CURRENT_LOG_TIME} ${SCREEN_LOGDIR}/screen-${service}.log
|
||||||
|
|
||||||
# TODO(dtroyer): Hack to get stdout from the Python interpreter for the logs.
|
# TODO(dtroyer): Hack to get stdout from the Python interpreter for the logs.
|
||||||
export PYTHONUNBUFFERED=1
|
export PYTHONUNBUFFERED=1
|
||||||
@ -1363,9 +1363,9 @@ function screen_process {
|
|||||||
screen -S $SCREEN_NAME -X screen -t $name
|
screen -S $SCREEN_NAME -X screen -t $name
|
||||||
|
|
||||||
if [[ -n ${SCREEN_LOGDIR} ]]; then
|
if [[ -n ${SCREEN_LOGDIR} ]]; then
|
||||||
screen -S $SCREEN_NAME -p $name -X logfile ${SCREEN_LOGDIR}/screen-${name}.${CURRENT_LOG_TIME}.log
|
screen -S $SCREEN_NAME -p $name -X logfile ${SCREEN_LOGDIR}/screen-${name}.log.${CURRENT_LOG_TIME}
|
||||||
screen -S $SCREEN_NAME -p $name -X log on
|
screen -S $SCREEN_NAME -p $name -X log on
|
||||||
ln -sf ${SCREEN_LOGDIR}/screen-${name}.${CURRENT_LOG_TIME}.log ${SCREEN_LOGDIR}/screen-${name}.log
|
ln -sf ${SCREEN_LOGDIR}/screen-${name}.log.${CURRENT_LOG_TIME} ${SCREEN_LOGDIR}/screen-${name}.log
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# sleep to allow bash to be ready to be send the command - we are
|
# sleep to allow bash to be ready to be send the command - we are
|
||||||
@ -1411,7 +1411,7 @@ function screen_rc {
|
|||||||
echo "stuff \"$2$NL\"" >> $SCREENRC
|
echo "stuff \"$2$NL\"" >> $SCREENRC
|
||||||
|
|
||||||
if [[ -n ${SCREEN_LOGDIR} ]]; then
|
if [[ -n ${SCREEN_LOGDIR} ]]; then
|
||||||
echo "logfile ${SCREEN_LOGDIR}/screen-${1}.${CURRENT_LOG_TIME}.log" >>$SCREENRC
|
echo "logfile ${SCREEN_LOGDIR}/screen-${1}.log.${CURRENT_LOG_TIME}" >>$SCREENRC
|
||||||
echo "log on" >>$SCREENRC
|
echo "log on" >>$SCREENRC
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -1523,8 +1523,8 @@ function _old_run_process {
|
|||||||
exec 6>&-
|
exec 6>&-
|
||||||
|
|
||||||
if [[ -n ${SCREEN_LOGDIR} ]]; then
|
if [[ -n ${SCREEN_LOGDIR} ]]; then
|
||||||
exec 1>&${SCREEN_LOGDIR}/screen-${1}.${CURRENT_LOG_TIME}.log 2>&1
|
exec 1>&${SCREEN_LOGDIR}/screen-${1}.log.${CURRENT_LOG_TIME} 2>&1
|
||||||
ln -sf ${SCREEN_LOGDIR}/screen-${1}.${CURRENT_LOG_TIME}.log ${SCREEN_LOGDIR}/screen-${1}.log
|
ln -sf ${SCREEN_LOGDIR}/screen-${1}.log.${CURRENT_LOG_TIME} ${SCREEN_LOGDIR}/screen-${1}.log
|
||||||
|
|
||||||
# TODO(dtroyer): Hack to get stdout from the Python interpreter for the logs.
|
# TODO(dtroyer): Hack to get stdout from the Python interpreter for the logs.
|
||||||
export PYTHONUNBUFFERED=1
|
export PYTHONUNBUFFERED=1
|
||||||
|
@ -20,7 +20,7 @@ set +o xtrace
|
|||||||
# Defaults
|
# Defaults
|
||||||
# --------
|
# --------
|
||||||
# for DSTAT logging
|
# for DSTAT logging
|
||||||
DSTAT_FILE=${DSTAT_FILE:-"dstat.txt"}
|
DSTAT_FILE=${DSTAT_FILE:-"dstat.log"}
|
||||||
|
|
||||||
|
|
||||||
# start_dstat() - Start running processes, including screen
|
# start_dstat() - Start running processes, including screen
|
||||||
|
19
stack.sh
19
stack.sh
@ -379,15 +379,14 @@ if [[ -n "$LOGFILE" || -n "$SCREEN_LOGDIR" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$LOGFILE" ]]; then
|
if [[ -n "$LOGFILE" ]]; then
|
||||||
# First clean up old log files. Use the user-specified ``LOGFILE``
|
# Clean up old log files. Append '.*' to the user-specified
|
||||||
# as the template to search for, appending '.*' to match the date
|
# ``LOGFILE`` to match the date in the search template.
|
||||||
# we added on earlier runs.
|
local logfile_dir="${LOGFILE%/*}" # dirname
|
||||||
LOGDIR=$(dirname "$LOGFILE")
|
local logfile_name="${LOGFILE##*/}" # basename
|
||||||
LOGFILENAME=$(basename "$LOGFILE")
|
mkdir -p $logfile_dir
|
||||||
mkdir -p $LOGDIR
|
find $logfile_dir -maxdepth 1 -name $logfile_name.\* -mtime +$LOGDAYS -exec rm {} \;
|
||||||
find $LOGDIR -maxdepth 1 -name $LOGFILENAME.\* -mtime +$LOGDAYS -exec rm {} \;
|
|
||||||
LOGFILE=$LOGFILE.${CURRENT_LOG_TIME}
|
LOGFILE=$LOGFILE.${CURRENT_LOG_TIME}
|
||||||
SUMFILE=$LOGFILE.${CURRENT_LOG_TIME}.summary
|
SUMFILE=$LOGFILE.summary.${CURRENT_LOG_TIME}
|
||||||
|
|
||||||
# Redirect output according to config
|
# Redirect output according to config
|
||||||
|
|
||||||
@ -408,8 +407,8 @@ if [[ -n "$LOGFILE" ]]; then
|
|||||||
|
|
||||||
echo_summary "stack.sh log $LOGFILE"
|
echo_summary "stack.sh log $LOGFILE"
|
||||||
# Specified logfile name always links to the most recent log
|
# Specified logfile name always links to the most recent log
|
||||||
ln -sf $LOGFILE $LOGDIR/$LOGFILENAME
|
ln -sf $LOGFILE $logfile_dir/$logfile_name
|
||||||
ln -sf $SUMFILE $LOGDIR/$LOGFILENAME.summary
|
ln -sf $SUMFILE $logfile_dir/$logfile_name.summary
|
||||||
else
|
else
|
||||||
# Set up output redirection without log files
|
# Set up output redirection without log files
|
||||||
# Set fd 3 to a copy of stdout. So we can set fd 1 without losing
|
# Set fd 3 to a copy of stdout. So we can set fd 1 without losing
|
||||||
|
Loading…
Reference in New Issue
Block a user