This patch allows MaNGOS to run as a daemon (starting and stopping are supported) without any third-party utilities (for example, GNU screen).
"<executable> -s run" start daemon ( will wait until MaNGOS is completely initialized or exit with non-zero return code in case of initialization failure)
"<executable> -s stop" stop daemon (will terminate the daemon process, or exit with non-zero return code if there is no such process or it was unable to terminate the process)
Please note: this patch is not guaranteed to work under BSD systems because it does not perform a double fork.
http://pastebin.com/sekMm28x