more search command tools

This commit is contained in:
orbiter 2012-12-10 21:01:14 +01:00
parent 54e193a2b8
commit f86d469973
6 changed files with 56 additions and 7 deletions

4
bin/search.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
cd "`dirname $0`"
port=$(grep ^port= ../DATA/SETTINGS/yacy.conf |cut -d= -f2)
./search1.sh -s localhost:$port '"$1"'

33
bin/search1.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
cd "`dirname $0`"
if which curl &>/dev/null; then
while getopts "ys" opt; do
case $opt in
y)
shift;
curl -s "http://$1/yacysearch.rss?query=$2" | awk '/^<link>/{ gsub("<link>","" );gsub("<\/link>","" ); print $0 }'
;;
s)
shift;
curl -s "http://$1/solr/select?q=text_t:$2&start=0&rows=100&fl=sku&wt=rss" | awk '/^<link>/{ gsub("<link>","" );gsub("<\/link>","" ); print $0 }'
;;
esac
done
elif which wget &>/dev/null; then
while getopts "ys" opt; do
case $opt in
y)
shift;
wget -q -O - "http://$1/yacysearch.rss?query=$2" | awk '/^<link>/{ gsub("<link>","" );gsub("<\/link>","" ); print $0 }'
;;
s)
shift;
wget -q -O - "http://$1/solr/select?q=text_t:$2&start=0&rows=100&fl=sku&wt=rss" | awk '/^<link>/{ gsub("<link>","" );gsub("<\/link>","" ); print $0 }'
;;
esac
done
else
echo "Neither curl nor wget installed!"
exit 1
fi

4
bin/searchall.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
cd "`dirname $0`"
port=$(grep ^port= ../DATA/SETTINGS/yacy.conf |cut -d= -f2)
./searchall1.sh -s localhost:$port $1

4
bin/searchall1.sh Executable file
View File

@ -0,0 +1,4 @@
TMPFILE=`mktemp -t search` || exit 1
for address in `./up1.sh $1`; do sleep 0.01; ./search1.sh -s $address $2 >> $TMPFILE & done
sleep 2
cat $TMPFILE

View File

@ -1,11 +1,5 @@
#!/bin/bash
cd "`dirname $0`"
port=$(grep ^port= ../DATA/SETTINGS/yacy.conf |cut -d= -f2)
if which curl &>/dev/null; then
curl -s "http://localhost:$port/Network.xml?page=1&ip=" | awk '/<address>/{ gsub("<address>","" );gsub("<\/address>","" ); print $0 }' | awk '{print $1}';
elif which wget &>/dev/null; then
wget -q -O - "http://localhost:$port/Network.xml?page=1&ip=" | awk '/<address>/{ gsub("<address>","" );gsub("<\/address>","" ); print $0 }' | awk '{print $1}';
else
exit 1
fi
./up1.sh localhost:$port

10
bin/up1.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
cd "`dirname $0`"
if which curl &>/dev/null; then
curl -s "http://$1/Network.xml?page=1&ip=" | awk '/<address>/{ gsub("<address>","" );gsub("<\/address>","" ); print $0 }' | awk '{print $1}';
elif which wget &>/dev/null; then
wget -q -O - "http://$1/Network.xml?page=1&ip=" | awk '/<address>/{ gsub("<address>","" );gsub("<\/address>","" ); print $0 }' | awk '{print $1}';
else
exit 1
fi