Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Add flush buffer function for initscript #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions debian/td-agent.init
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,14 @@ do_reload() {
return 0
}

#
# Function that sends a USR1 Signal to the daemon/service
#
do_flush() {
start-stop-daemon --stop --signal USR1 --quiet --pidfile $PIDFILE --name ruby
return 0
}

do_configtest() {
eval "$DAEMON_ARGS --user ${USER} --group ${GROUP} --dry-run -q"
}
Expand Down Expand Up @@ -185,12 +193,14 @@ case "$1" in
;;
esac
;;
flush)
do_flush
;;
configtest)
do_configtest
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload|configtest}" >&2
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|flush|configtest|status}" >&2
exit 3
;;
esac
Expand Down
12 changes: 11 additions & 1 deletion redhat/td-agent.init
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ reload() {
echo
}

flush() {
echo -n "Flushing buffer $name: "
killproc $td_agent -USR1
RETVAL=$?
echo
}

configtest() {
eval "$TD_AGENT_ARGS $DAEMON_ARGS --dry-run -q"
}
Expand All @@ -140,6 +147,9 @@ case "$1" in
reload)
reload
;;
flush)
flush
;;
condrestart)
[ -f /var/lock/subsys/$prog ] && restart || :
;;
Expand All @@ -150,7 +160,7 @@ case "$1" in
status -p $PIDFILE 'td-agent'
;;
*)
echo "Usage: $prog {start|stop|reload|restart|condrestart|status|configtest}"
echo "Usage: $prog {start|stop|restart|reload|flush|condrestart|configtest|status}"
exit 1
;;
esac
Expand Down