I have installed elasticsearch . This is how I am running it currently.
cd /elasticsearch-6.3.1/bin
./elasticsearch
It is working fine. But, I want to run this program as a service. Like, I want to run it like,
sudo service elasticsearch restart
It should run the elasticsearch. I have tried to create a script in /etc/init.d
, but it is not working. This is what I did,
cd /etc/init.d
sudo vim elasticsearch
This is content in that file,
cd /elasticsearch-6.3.1/bin
./elasticsearch
What is the recommended way to achieve this ?