Files
apps/methode/hashes/robot.sh
2018-10-31 10:06:43 +01:00

35 lines
751 B
Bash
Executable File

#!/bin/bash
METHODE=hashes
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
for BLOCK in `grep LAST $DATA_PATH/block_list.txt | awk '{print $2}'`
do
if [ ! -f $DATA_PATH/$METHODE/$BLOCK.png ]
then
BLOCK_HEIGHT=`grep $BLOCK $DATA_PATH/block_list.txt | awk '{print $3}'`
php robot.php $BLOCK $((RANDOM % 6))
echo $BLOCK_HEIGHT $BLOCK >> $DATA_PATH/hashes2hashes/liste.txt
fi
BNAME=`grep $BLOCK $DATA_PATH/block_list.txt | awk '{print $1}'`
if [ "$BNAME" == "LAST" ]
then
touch $DATA_PATH/$METHODE/$BLOCK.png
else
touch -t $date $DATA_PATH/$METHODE/$BLOCK.png
fi
done
rm -f $flag