#275 pid file not always created when executed during startup

open
nobody
Service (34)
5
2012-12-11
2012-09-28
Gilles Rayrat
No

Startup script uses the following line in getpid() function for '*' DIST_OS :
pidtest=`$PSEXE -p $pid -o args | grep -F "$WRAPPER_CMD" | tail -1`

On Debian 6.x, it appears that the "ps ... |grep ..." functions behave differently when it is called from within a startup script
Other system will properly pass the full output of ps to grep, while Debian 6.x passes only the truncated output to grep
This leads to not starting properly the application, with startup logs like:
Thu Sep 20 14:55:42 2012: Starting <app>...
Thu Sep 20 14:55:42 2012: Removed stale pid file: <path to>.pid

Adding the -ww flag to ps, like with macosx, solves the problem. Corrected line:
pidtest=`$PSEXE -p $pid -ww -o args | grep -F "$WRAPPER_CMD" | tail -1`

Discussion