> But wouldn't the port passed to the server start process be 7007 (production port)?

It would be, if the issue is, as @gimick describes, that the pid file was deleted, but we're trying to start the server from the same directory. If someone downloaded another copy of KA Lite, however, and ran it with the default settings (port 8008, taken by Nginx), then it would kill the other server without freeing up the port. The code then goes on to check whether KA Lite is still running on that port, and it wouldn't be (since it was killed), but it doesn't check again whether the port is available. I'll add a recommended addition a few lines down in the code.