24 lines
423 B
Bash
24 lines
423 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
#set -x
|
||
|
|
||
|
if [ -z "$1" ]
|
||
|
then
|
||
|
echo "Usage: $0 FILE"
|
||
|
exit 0
|
||
|
fi
|
||
|
|
||
|
cat $1 | while read line
|
||
|
do
|
||
|
echo "${line}"
|
||
|
QUEUE=$(curl -sd "action=cut&txt=${line}" -H "Content-Type: application/x-www-form-urlencoded" -X POST http://tpaas.chaostreff.ch/ | grep '<li>' | wc -l)
|
||
|
if [ ${QUEUE} -ge 5 ]
|
||
|
then
|
||
|
echo "Queue full, sleeping...."
|
||
|
sleep 35
|
||
|
else
|
||
|
echo "Sending one line..."
|
||
|
sleep 0.5
|
||
|
fi
|
||
|
done
|