yacy-maintenance-scripts/optimize-solr.sh

49 lines
2.1 KiB
Bash
Executable File

#!/bin/sh
#####################
## DONT USE THIS YET
## IT IS NOT WORKING
#####################
run_optimization ()
{
curl 'http://localhost:8090/IndexControlURLs_p.html' --compressed -H 'Content-Type: multipart/form-data; boundary=---------------------------235673988741872774353817691589' --data-binary $'-----------------------------235673988741872774353817691589\r\nContent-Disposition: form-data; name="transactionToken"\r\n\r\nTOKEN_HERE\r\n-----------------------------235673988741872774353817691589\r\nContent-Disposition: form-data; name="optimizemax"\r\n\r\n20\r\n-----------------------------235673988741872774353817691589\r\nContent-Disposition: form-data; name="optimizesolr"\r\n\r\nOptimize Solr\r\n-----------------------------235673988741872774353817691589--\r\n'
curl 'http://localhost:8090/Blacklist_p.html' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Content-Type: multipart/form-data; boundary=---------------------------70675837311993919383702838946' --data-binary $'-----------------------------70675837311993919383702838946\r\nContent-Disposition: form-data; name="currentBlacklist"\r\n\r\nurl.default.black\r\n-----------------------------70675837311993919383702838946\r\nContent-Disposition: form-data; name="newEntry"\r\n\r\n'$1$'\r\n-----------------------------70675837311993919383702838946\r\nContent-Disposition: form-data; name="addBlacklistEntry"\r\n\r\nAdd URL pattern\r\n-----------------------------70675837311993919383702838946--\r\n' >/dev/null 2>&1
if [ "$?" == 0 ]; then
echo 'I| added to blacklist: '$1
else
echo 'E| CURL failed on adding entry to blacklist'
exit 3
fi
}
exit 0
add_entry_domainonly ()
{
add_entry $1'/.*'
}
add_entry_domainandsub ()
{
add_entry $1'/.*'
add_entry '*.'$1'/.*'
}
if [ "$1" == '' ]; then
echo 'E| you must specify the domain to add'
exit 1
fi
if [ "$2" == 0 ]; then
add_entry_domainonly $1
elif [ "$2" == 1 ]; then
add_entry_domainandsub $1
else
echo 'E| second parameter must be one of [ 0 | 1 ]'
exit 2
fi