Linux教程

linux的系统服务

本文主要是介绍linux的系统服务,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1、编辑一个sevice文件

vim  /usr/lib/systemd/system/elasticsearch.service

2、设置相关的用户和路径

# StandardOutput is configured to redirect to journalctl since
# some error messages may be logged in standard output before
# elasticsearch logging system is initialized. Elasticsearch
# stores its logs in /var/log/elasticsearch and does not use
# journalctl by default. If you also want to enable journalctl
# logging, you can simply remove the "quiet" option from ExecStart.
[Unit]
Description=elasticsearch
After=network.target

[Service]
Type=simple
User=elasticsearch
Group=elasticsearch
LimitNOFILE=100000
LimitNPROC=100000
Restart=no
ExecStart=/opt/elasticsearch-7.12.0/bin/elasticsearch
PrivateTmp=true

[Install]
WantedBy=multi-user.target 

 

3、开启相关的服务

systemctl status elasticsearch
systemctl start  elasticsearch

  

这篇关于linux的系统服务的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!