Consult $PGPORT when setting port, with this our reported port follows the same precedence as the one used by postgres: postgresql.conf -> $PGPORT -> default port (5432).
Set isRunning when Postgres is started the first time and need to setup the database.
Removed the attempt to restart the server if startup failed. Since we now use -w and get proper exist status back, we know if startup failed and if it failed there is no reason to think it will work immediately again.