Skip to content

Instantly share code, notes, and snippets.

@leedavis81
Created October 11, 2012 16:58
Show Gist options
  • Save leedavis81/3873877 to your computer and use it in GitHub Desktop.
Save leedavis81/3873877 to your computer and use it in GitHub Desktop.
Create a new core
#!/bin/bash
# creates a new Solr core
if [ "$1" = "" ]; then
echo -n "Name of core to create: "
read name
else
name=$1
fi
mkdir -p /var/lib/solr/data/$name
chown tomcat6.tomcat6 /var/lib/solr/data/$name
mkdir -p /etc/solr/conf/$name/conf
cp -a /etc/solr/conftemplate/* /etc/solr/conf/$name/conf/
sed -i "s/CORENAME/$name/" /etc/solr/conf/$name/conf/solrconfig.xml
curl "http://127.0.0.1:8080/solr/admin/cores?action=CREATE&name=$name&instanceDir=/etc/solr/conf/$name"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment