#! /bin/sh

OLDLS=""; EQUAL=0

until touch $1.x; ln $1.x $1 2> /dev/null
do
  LS="`ls -l $1 2> /dev/null`"
  if test "$OLDLS" = "$LS"
  then
    EQUAL=`expr $EQUAL + 1`
    if test $EQUAL -ge 30
    then
      rm -f $1; OLDLS=""; EQUAL=0
    fi
  else
    OLDLS="$LS"; EQUAL=0
  fi
  sleep 30
done
rm -f $1.x
