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
diff --git a/lib/dstat b/lib/dstat
index d1db469..8165e5c 100644
--- a/lib/dstat
+++ b/lib/dstat
@@ -29,7 +29,7 @@
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} ]]; then
+ if [[ -n ${SCREEN_LOGDIR} && ${SCREEN_LOGDIR} != ${LOGDIR} ]]; then
# Drop the backward-compat symlink
ln -sf $LOGDIR/$DSTAT_FILE ${SCREEN_LOGDIR}/$DSTAT_FILE
fi