Browse code

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

Daniel P. Berrange authored on 2015/01/31 02:03:32
Showing 1 changed files
... ...
@@ -29,7 +29,7 @@ function start_dstat {
29 29
     DSTAT_OPTS="-tcmndrylpg --top-cpu-adv --top-io-adv"
30 30
     if [[ -n ${LOGDIR} ]]; then
31 31
         screen_it dstat "cd $TOP_DIR; dstat $DSTAT_OPTS | tee $LOGDIR/$DSTAT_FILE"
32
-        if [[ -n ${SCREEN_LOGDIR} ]]; then
32
+        if [[ -n ${SCREEN_LOGDIR} && ${SCREEN_LOGDIR} != ${LOGDIR} ]]; then
33 33
             # Drop the backward-compat symlink
34 34
             ln -sf $LOGDIR/$DSTAT_FILE ${SCREEN_LOGDIR}/$DSTAT_FILE
35 35
         fi