5
0
Fork 1
forked from encrypt/toot
This commit is contained in:
jops 2019-02-24 00:33:29 +01:00
parent 4d1f22cc3c
commit 4383a9769c

View file

@ -5,7 +5,8 @@
# #
# Interval between two consecutive posts # Interval between two consecutive posts
SLEEP_INTERVAL=3h FLOOR_HOUR_SLEEP_INTERVAL=5
CEILING_HOUR_SLEEP_INTERVAL=19
# File containing the toots to post # File containing the toots to post
DATA_FILE=megafono.txt DATA_FILE=megafono.txt
@ -14,14 +15,28 @@ DATA_FILE=megafono.txt
# CONFIGURATION END # CONFIGURATION END
# #
random_time_on_range(){
FLOOR=$1
CEILING=$2
RANGE=$(($CEILING-$FLOOR+1));
#echo "You will generate a random number between $FLOOR and $CEILING (both inclusive). There are $RANGE possible numbers!"
RESULT=$RANDOM;
#echo "We just generated the random number $RESULT, which might not be in the range we want";
let "RESULT %= $RANGE";
RESULT=$(($RESULT+$FLOOR));
echo $RESULT;
}
while : while :
do do
# Last line should be empty, so we dont need an additional read here # Last line should be empty, so we dont need an additional read here
# after the while loop # after the while loop
while read line while read line
do do
eval ./toot.sh $line #eval ./toot.sh $line
sleep ${SLEEP_INTERVAL} SLEEP_TOOT=$(random_time_on_range $FLOOR_HOUR_SLEEP_INTERVAL $CEILING_HOUR_SLEEP_INTERVAL)
sleep $SLEEP_TOOT"h"
done < ${DATA_FILE} done < ${DATA_FILE}
done done