Use directory from config for checking pid rather than a static one.

The old solution doesn't work if you tend to set a different pid file location in the config.