Last active
September 8, 2017 14:52
-
-
Save ycyr/70218df1cb7f3989136b98dcbae220d0 to your computer and use it in GitHub Desktop.
filebeat script centos 5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# filebeat: Startup script for Filebeat Log Shipper. | |
# | |
# chkconfig: 3 80 05 | |
# description: Startup script for Filebeat Log Shipper standalone | |
FILEBEAT_HOME=/usr/local/filebeat; | |
export FILEBEAT_HOME | |
start() { | |
echo -n "Starting Filebeat: " | |
/usr/local/filebeat/filebeat \ | |
-c /etc/filebeat/filebeat.yml \ | |
-path.home /usr/share/filebeat \ | |
-path.config /etc/filebeat \ | |
-path.data /var/lib/filebeat \ | |
-path.logs /var/log/filebeat & | |
sleep 2 | |
echo "done" | |
} | |
stop() { | |
echo -n "Stopping Filebeat: " | |
su $FILEBEAT_OWNER -c "pkill filebeat" | |
echo "done" | |
} | |
# See how we were called. | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
stop | |
start | |
;; | |
status) | |
if pgrep -fl "/usr/local/filebeat/filebeat" > /dev/null;then echo running;else echo not running;fi | |
;; | |
*) | |
echo $"Usage: filebeat {start|stop|restart}" | |
exit | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment