dstat: avoid creating self-referential symlink

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
This commit is contained in:
Daniel P. Berrange 2015-01-30 17:03:32 +00:00
parent b9a7d3b5e4
commit 901dbecd4c

View File

@ -29,7 +29,7 @@ function start_dstat {
DSTAT_OPTS="-tcmndrylpg --top-cpu-adv --top-io-adv" DSTAT_OPTS="-tcmndrylpg --top-cpu-adv --top-io-adv"
if [[ -n ${LOGDIR} ]]; then if [[ -n ${LOGDIR} ]]; then
screen_it dstat "cd $TOP_DIR; dstat $DSTAT_OPTS | tee $LOGDIR/$DSTAT_FILE" screen_it dstat "cd $TOP_DIR; dstat $DSTAT_OPTS | tee $LOGDIR/$DSTAT_FILE"
if [[ -n ${SCREEN_LOGDIR} ]]; then if [[ -n ${SCREEN_LOGDIR} && ${SCREEN_LOGDIR} != ${LOGDIR} ]]; then
# Drop the backward-compat symlink # Drop the backward-compat symlink
ln -sf $LOGDIR/$DSTAT_FILE ${SCREEN_LOGDIR}/$DSTAT_FILE ln -sf $LOGDIR/$DSTAT_FILE ${SCREEN_LOGDIR}/$DSTAT_FILE
fi fi