Use isvalidpid() function instead of testing for PID file when restarting.