File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -197,11 +197,11 @@ start_service() {
197197stop_service () {
198198 if [ -e ${PIDFILE} ]; then
199199 echo -n " Stopping ${SERVICE_NAME} : "
200- if kill -TERM $( cat ${PIDFILE} ) 2> /dev/null; then
200+ if kill -TERM $( cat ${PIDFILE} 2> /dev/null ) 2> /dev/null; then
201201 sec=1
202202 while [ " $sec " -le 15 ]; do
203203 if [ -e ${PIDFILE} ]; then
204- if kill -0 $( cat ${PIDFILE} ) 2> /dev/null; then
204+ if kill -0 $( cat ${PIDFILE} 2> /dev/null ) 2> /dev/null; then
205205 echo -n " . "
206206 sleep 1
207207 else
@@ -214,15 +214,22 @@ stop_service() {
214214 done
215215 fi
216216
217- if kill -0 $( cat ${PIDFILE} ) 2> /dev/null; then
217+ if kill -0 $( cat ${PIDFILE} 2> /dev/null ) 2> /dev/null; then
218218 echo " Unable to shut down nicely, killing the process!"
219- kill -KILL $( cat ${PIDFILE} ) 2> /dev/null
219+ kill -KILL $( cat ${PIDFILE} 2> /dev/null ) 2> /dev/null
220220 else
221221 echo " complete!"
222222 fi
223223
224+ # Start the reader (in case tail stopped already)
225+ cat ${FIFO} &
226+ # Open pipe for writing.
227+ exec 3> ${FIFO}
224228 # Write a newline to the pipe, this triggers a SIGPIPE and causes tail to exit
225- echo " " > ${FIFO}
229+ echo " " >&3
230+ # Close pipe.
231+ exec 3>& -
232+
226233 rm ${PIDFILE} 2> /dev/null
227234 return 0 # we've either shut down gracefully or killed the process
228235 else
You can’t perform that action at this time.
0 commit comments