windows上沒有
nohup run.sh &
一直開啟cmd窗口,實在不方便,所以找到了WinSW
工具
下載
選擇如下兩個文件下載
配置
下載完成后,放在同一文件夾下,重命名為相同的名字,如下
編輯xml
文件如下
<service>
<!-- ID of the service. It should be unique across the Windows system-->
<id>elasticsearch7</id>
<!-- Display name of the service -->
<name>elasticsearch7</name>
<!-- Service description -->
<description>This service is a service created from a minimal configuration</description>
<!-- Path to the executable, which should be started -->
<executable>D:\MyProgram\development\elk\elasticsearch-7.7.1\bin\elasticsearch.bat</executable>
<!-- <arguments>-jar statement-0.0.1-SNAPSHOT.jar</arguments> -->
</service>
### 注冊服務
當前文件夾下以管理員身份打開cmd
,運行boot.exe install
啟動服務并運行
提示成功后services.msc
打開服務列表,啟動對用的服務,并設置為自啟動即可