Use alternative approach to find unused PID

ps ax appears to fail on builds.apache.org, use alternative
approach of finding an unused PID which even is more effective.

Based on PR #95, only one commit in this one.