Skip to content

Instantly share code, notes, and snippets.

@faisalmansoor
Last active August 29, 2015 14:10
Show Gist options
  • Save faisalmansoor/d43faf36a3e777a854ac to your computer and use it in GitHub Desktop.
Save faisalmansoor/d43faf36a3e777a854ac to your computer and use it in GitHub Desktop.
Deploy SOLR Core config to remote server
REM Deploys solr core config from windows client to solr on linux server
REM Assumes that plink and pscp are on path, and pagent.exe contains ssh keys for the linux server
REM Stops Solr service - Copies Solr config - Start Solr service
REM Usage: deploy-solr-core.bat UserName@Host CoreName
@echo off
if [%1]==[] goto usage
if [%2]==[] goto usage
@echo on
plink -ssh -t %1 sudo /etc/init.d/solr stop
plink -ssh %1 rm -r /tmp/solr/%2/
plink -ssh %1 mkdir -p /tmp/solr/%2/conf
plink -ssh -t %1 sudo chmod g+s /opt/solr/solr/%2/
pscp -r -v ./conf/ %1:/tmp/solr/%2/conf/
pscp -r -v ./conf/ %1:/tmp/solr/%2/conf/
plink -ssh -t %1 sudo rm -r /opt/solr/solr/%2/conf/
plink -ssh -t %1 sudo mv /tmp/solr/%2/conf/ /opt/solr/solr/%2/conf/
plink -ssh -t %1 sudo chown -R solr /opt/solr/solr/%2/conf
plink -ssh -t %1 sudo chgrp -hR solr /opt/solr/solr/%2/conf
plink -ssh -t %1 sudo /etc/init.d/solr start
@echo off
goto :eof
:usage
@echo Usage: %0 UserName@Host CoreName [user name and password are fetched from pagent.exe]
exit /B 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment