以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