#!/bin/bash
METHODE=hashes2hashes
flag=$TMP_PATH/${METHODE}_bot.flag
date=`date +%Y%m%d0000`

if [ -f $flag ];
then
  echo "${METHODE}_bot is already running !"
  exit 0
fi
touch $flag

cd $APPS_PATH/methode/$METHODE
SIZE=6
BLOCK=`grep LAST $DATA_PATH/block_list.txt | awk '{print $2}'`
HEIGHT=`grep LAST $DATA_PATH/block_list.txt | awk '{print $3}'`

if [ $((HEIGHT % SIZE)) -eq 0 ]
then
  if [ ! -f $DATA_PATH/$METHODE/$BLOCK.png ]
  then
    php robot.php $BLOCK $SIZE
  fi
fi

rm -f $flag
