以filebeat开机自启为例:
1.创建shell文件filebeat.sh:
#!/bin/bash
nohup /usr/local/filebeat/filebeat-6.5.3-linux-x86_64/filebeat -e -c /usr/local/filebeat/filebeat-6.5.3-linux-x86_64/filebeat.yml > /dev/null 2>&1 &
2.给shell赋执行权限
chmod +x filebeat.sh
3.给rc.local赋执行权限
chmod +x /etc/rc.d/rc.local
4.编辑rc.local文件
vim /etc/rc.d/rc.local在文件末尾添加shell文件路径,如下所示
/usr/local/filebeat/filebeat-6.5.3-linux-x86_64/filebeat.sh