龙空技术网

filebeat设置开机自启动

小白2020 94

前言:

目前你们对“centossystemctl自启动”可能比较讲究,姐妹们都想要分析一些“centossystemctl自启动”的相关文章。那么小编同时在网摘上网罗了一些有关“centossystemctl自启动””的相关知识,希望姐妹们能喜欢,大家一起来学习一下吧!

系统环境: centos7

filebeat版本: 7.2

配置方法

1. 进入自启动目录:

cd /lib/systemd/systemvim filebeat.service

2.编写filebeat.service

[Unit]Description=filebeatWants=network-online.targetAfter=network-online.target[Service]User=rootExecStart=/var/filebeat/filebeat -e -c /var/filebeat/filebeat.yml  #/var/filebeat为filebeat的安装目录Restart=always  #设置为掉线自动重启,进程强制杀掉后会自动重新启动[Install]WantedBy=multi-user.target

3.启动验证

systemctl daemon-reload  #加载配置systemctl start filebeat              #启动filebeat服务systemctl enable filebeat             #设置开机自启动systemctl disable filebeat            #停止开机自启动systemctl status filebeat             #查看服务当前状态systemctl restart filebeat           #重新启动服务systemctl list-units --type=service        #查看所有已启动的服务

标签: #centossystemctl自启动