Logstash在Centos6加入系统服务脚本

1
2
ln -s /usr/local/java/jdk1.8.0_151/bin/java /usr/bin/
vim /etc/init.d/logstash

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
#chkconfig: 35 99 20
#description: This is zhe Logstash server
LOGSTASH="/a01/apps/logstash/bin/logstash"
LOGSTASH_CONF_FILE="/etc/logstash/logstash.conf"
PID="/var/run/logstash.pid"
NAME="Logstash"
KILL=`cat /var/run/logstash.pid`

case "$1" in
start)
echo "starting $NAME..."
nohup $LOGSTASH -f $LOGSTASH_CONF_FILE &
echo $! > $PID
echo "$NAME is started,zhe pidfile in $PID ......"
;;

stop)
echo "stopping $NAME..."
kill -s 9 $KILL
echo > $PID
echo "$NAME is DOWN"
;;
esac
博主QQ:1012405802
技术交流QQ群:830339411
版权声明:网站内容有原创和转载,如有侵权,请联系删除,谢谢!!
感谢打赏,93bok因你们而精彩!!(支付宝支持花呗)
0%