Roman, thanks for the feedback.
The reason I used the pidofproc (from patch1 of
BIGTOP-782) instead of kill -0 approach (from patch 2) was because pidofproc's exit code is one of the LSB defined exit status codes for "status".
Consequently, the exit code for pidofproc can be:
0 program is running or service is OK
1 program is dead and /var/run pid file exists
2 program is dead and /var/lock lock file exists
3 program is not running
4 program or service status is unknown
5-99 reserved for future LSB use
100-149 reserved for distribution use
150-199 reserved for application use
If we use kill -0 for status, I wasn't able to find concrete documentation as to what the exit code would be. The best I could find was "0" if process is running and "1" if it wasn't. So, the non-success error codes wouldn't have been compatible with pidofproc.
Moreover, other components (I looked at common/flume/flume-agent.init) seem to doing similar things, using kill commands for stopping but pidofproc for status.
For stopping the process, kill commands are ok because we explicitly return 0 but to me it seemed like we should continue to use pidofproc for status.
What do you think?