美文网首页
问题2:Linux中设置程序自启动服务-(Centos 7以上)

问题2:Linux中设置程序自启动服务-(Centos 7以上)

作者: 一到家就变乖 | 来源:发表于2019-03-29 10:26 被阅读0次

该方法应该只支持Centos 7及以上版本Linux系统,未其他系统测试。

[Unit]
Description=Prometheus Service

[Service]
//可执行文件路径
ExecStart=/prometheus_install/prometheus-2.7.2.linux-amd64/prometheus  --config.file=/prometheus_install/prometheus-2.7.2.linux-amd64/prometheus.yml
//重启模式
Restart=always

[Install]
WantedBy=multi-user.target

按照该方式应该就可以实现自启动,[Service]中还可以设置日志路径等参数。

相关文章

网友评论

      本文标题:问题2:Linux中设置程序自启动服务-(Centos 7以上)

      本文链接:https://www.haomeiwen.com/subject/akbkbqtx.html