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() {
197
197
stop_service () {
198
198
if [ -e ${PIDFILE} ]; then
199
199
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
201
201
sec=1
202
202
while [ " $sec " -le 15 ]; do
203
203
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
205
205
echo -n " . "
206
206
sleep 1
207
207
else
@@ -214,15 +214,22 @@ stop_service() {
214
214
done
215
215
fi
216
216
217
- if kill -0 $( cat ${PIDFILE} ) 2> /dev/null; then
217
+ if kill -0 $( cat ${PIDFILE} 2> /dev/null ) 2> /dev/null; then
218
218
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
220
220
else
221
221
echo " complete!"
222
222
fi
223
223
224
+ # Start the reader (in case tail stopped already)
225
+ cat ${FIFO} &
226
+ # Open pipe for writing.
227
+ exec 3> ${FIFO}
224
228
# 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
+
226
233
rm ${PIDFILE} 2> /dev/null
227
234
return 0 # we've either shut down gracefully or killed the process
228
235
else
You can’t perform that action at this time.
0 commit comments