使用elasticsearch软件举例:
1.编写 elasticsearch.service 文件
[Unit]
Description=elasticsearch
After=network.target
[Service]
Type=simple
User=elasticsearch
Group=elasticsearch
LimitNOFILE=100000
LimitNPROC=100000
Restart=no
ExecStart=/opt/elasticsearch-5.6.8/bin/elasticsearch
PrivateTmp=true
[Install]
WantedBy=multi-user.target
2.保存文件到:/usr/lib/systemd/system/ 路径
3.重新加载服务的配置文件
# systemctl daemon-reload
4.开启服务:
# systemctl start elasticsearch.service