Skip to content

Instantly share code, notes, and snippets.

@yriveiro
Created October 17, 2013 18:51
Show Gist options
  • Save yriveiro/7030222 to your computer and use it in GitHub Desktop.
Save yriveiro/7030222 to your computer and use it in GitHub Desktop.
Script to post json data to solr.
#!/bin/bash
for f in *.ready
do
status=$(curl --write-out %{http_code} --silent --output /dev/null http://192.168.20.101:8983/solr/statistics-$1/update? --data-binary @$f -H 'Content-type:application/json')
if [ $status -eq 200 ]
then
echo "Removing file $f"
rm -f $f
else
echo "File $f not posted. CODE: $status"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment