Create the pid file after binding to 2222

Version 1.402

Bugfix
Finished

Until now, the PID file for DA was created shortly after the binary started running, but before the code that binds to port 2222. This caused a pid sync issue if DA was attempted to be started, while it was already running. The 2nd instance overwrote the pid file of the active process.. but the 2nd instance failed/quit because it couldn't bind to 2222. The change moves the PID creation to a point in the code after the binding to 2222, so that the PID file will always contain the correct value.

Interested to try DirectAdmin? Get a 30-day Free Trial!