1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
#!/bin/sh
#CCCP script by hampa@chello.se
#this script will connect to all hubs and do a search query
#only hubs with atleast minusers in
minusers=30
d=`date "+%H-%M-%S"`
echo "DC multihub search script."
case $# in
0) echo "Usage: " `basename $0` "<search query>";
exit 255;
esac
searchquery=$1
#######################################
#you must first be connected to one hub
cccp -L > /dev/null
if [ $? -ne "0" ]
then
echo "Please connect to a hub first"
exit
fi
########################
#
searchfile="mhs-$d.log"
echo "saving searches to $searchfile"
########################
#internal variables
s4='$4'
s2='$2'
hublist=`hublist | awk -F\| "{if($s4>$minusers) print $s2}"`
connected=0
for hub in $hublist
do
echo searching for $searchquery in hub $hub
cccp -N -H $hub -s "$searchquery" 2>/dev/null >> $searchfile
echo connecting to $hub
cccp -H $hub -r "GOTO $hub" 2> /dev/null
hits=`wc -l $searchfile| awk '{print $1}'`
echo "searchfile now has $hits hits"
#echo sleeping 30 sek
sleep 30
done
|