Files
apps/twitter/emptybot/robot.sh
2019-01-27 07:28:31 +01:00

39 lines
887 B
Bash
Executable File

#!/bin/bash
flag=$TMP_PATH/emptybot_bot.flag
if [ -f $flag ];
then
echo "empty_bot is already running !"
exit 0
fi
touch $flag
cd $APPS_PATH/twitter/emptybot
#
# Se lancer pour un tweet sur un block unique
#
BLOCK_LINE=`grep LAST $DATA_PATH/block_list.txt`
BLOCK_HASH=`echo ${BLOCK_LINE} | awk '{print $2}'`
BLOCK_NAME=`echo ${BLOCK_LINE} | awk '{print $1}'`
BLOCK_HEIGHT=`echo ${BLOCK_LINE} | awk '{print $3}'`
BLOCK_SIZE=`echo ${BLOCK_LINE} | awk '{print $4}'`
if [ $BLOCK_SIZE -eq 1 ]
then
if [ -f $DATA_PATH/hasard/$BLOCK_HASH.png ]
then
if [ ! -f $DATA_PATH/emptybot/$BLOCK_HASH.png ]
then
echo Tweet EmptyBlock for $BLOCK_HASH
echo $BLOCK_LINE >> $DATA_PATH/emptybot/list.txt
php robot.php $BLOCK_HASH $BLOCK_NAME hasard $BLOCK_HEIGHT
# Don't TWEET it again ...
touch $DATA_PATH/twitterbot/$BLOCK_HASH
fi
fi
fi
rm -f $flag