In this article, I have demonstrated the init script for solr service. This script is used to start, stop and restart solr service.
By default, Solr will not provide you init script or not install script on system.
This script is tested on Debian Operating system but should work elsewhere without facing any issues.
In my previous article, i have explained about the integration of Apache Solr with Magento. If you have not yet installed apache Solr or you don’t have any idea about installation of Apache Solr refer below link,
Read: Installation & Configuration of Apache Solr with Magento.
Now come to the point, before using below script on the server. Make sure you have install below dependency package. This package helps to run Solr service.
sudo apt-get install daemon