901dbecd4c
If the SCREEN_LOGDIR and LOGDIR environment variables point to the same location, devstack creates a dstat.log which is a symlink pointing to itself. The second invokation of devstack then fails trying to reference this broken symlink Change-Id: I1de2bb7983e7535b41b28f526083a0d77312ff85
48 lines
1.0 KiB
Bash
48 lines
1.0 KiB
Bash
#!/bin/bash
|
|
#
|
|
# lib/dstat
|
|
# Functions to start and stop dstat
|
|
|
|
# Dependencies:
|
|
#
|
|
# - ``functions`` file
|
|
|
|
# ``stack.sh`` calls the entry points in this order:
|
|
#
|
|
# - start_dstat
|
|
# - stop_dstat
|
|
|
|
# Save trace setting
|
|
XTRACE=$(set +o | grep xtrace)
|
|
set +o xtrace
|
|
|
|
|
|
# Defaults
|
|
# --------
|
|
# for DSTAT logging
|
|
DSTAT_FILE=${DSTAT_FILE:-"dstat.log"}
|
|
|
|
|
|
# start_dstat() - Start running processes, including screen
|
|
function start_dstat {
|
|
# A better kind of sysstat, with the top process per time slice
|
|
DSTAT_OPTS="-tcmndrylpg --top-cpu-adv --top-io-adv"
|
|
if [[ -n ${LOGDIR} ]]; then
|
|
screen_it dstat "cd $TOP_DIR; dstat $DSTAT_OPTS | tee $LOGDIR/$DSTAT_FILE"
|
|
if [[ -n ${SCREEN_LOGDIR} && ${SCREEN_LOGDIR} != ${LOGDIR} ]]; then
|
|
# Drop the backward-compat symlink
|
|
ln -sf $LOGDIR/$DSTAT_FILE ${SCREEN_LOGDIR}/$DSTAT_FILE
|
|
fi
|
|
else
|
|
screen_it dstat "dstat $DSTAT_OPTS"
|
|
fi
|
|
}
|
|
|
|
# stop_dstat() stop dstat process
|
|
function stop_dstat {
|
|
screen_stop dstat
|
|
}
|
|
|
|
# Restore xtrace
|
|
$XTRACE
|