Created
October 31, 2012 06:20
-
-
Save j138/3985344 to your computer and use it in GitHub Desktop.
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/sh | |
# | |
# chkconfig: - 85 15 | |
# description: fluentd daemon | |
# Source function library. | |
. /etc/rc.d/init.d/functions | |
# parameter | |
shell=/bin/bash | |
fluentd=/usr/local/bin/fluentd | |
configfile=/etc/fluent/fluent.conf | |
logfile=/var/log/fluentd.log | |
pidfile=/var/run/fluentd.pid | |
lockfile=/var/lock/subsys/fluentd.lock | |
kill=/bin/kill | |
RETVAL=0 | |
start() { | |
KIND="fluetnd" | |
echo -n $"Starting $KIND services: " | |
daemon ${fluentd} -c ${configfile} -d ${pidfile} -o ${logfile} | |
#${fluentd} -c ${configfile} -d ${pidfile} -o ${logfile} | |
RETVAL=$? | |
echo "" | |
[ $RETVAL -eq 0 ] && touch $lockfile || RETVAL=1 | |
return $RETVAL | |
} | |
stop() { | |
echo | |
KIND="fluetnd" | |
echo -n $"Shutting down $KIND services: " | |
killproc -p ${pidfile} ${fluetnd} | |
#stop program = "${shell} -c 'kill -TERM `cat ${pidfile}`'" | |
RETVAL=$? | |
[ $RETVAL -eq 0 ] && rm -f $lockfile | |
echo "" | |
return $RETVAL | |
} | |
restart() { | |
stop | |
start | |
} | |
reload() { | |
KIND="fluetnd" | |
echo -n $"Reloading $KIND services: " | |
$kill -SIGUSR1 `cat ${pidfile}` | |
killproc ${fluentd} -HUP | |
RETVAL=$? | |
echo "" | |
return $RETVAL | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
restart | |
;; | |
reload) | |
reload | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|restart|reload}" | |
exit 2 | |
esac | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment