Multiple exit codes for FXServer

Currently, every failure of the FiveM server returns an exit code of 1.

For those automating the server launch, we can’t see what error was.

This can cause problems for when we want to auto restart the server.

For example, the manager restarts the server after an exit code of 1. But because we don’t know if the problem was a license failure, segmentation fault or just a script problem (common), the server might keep crashing just wasting system resources.

Something like this might work:

0: Normal Exit
1: Unknown Error
2: Invalid License
3: C++ Exceptions (CURL?)
4: Critical script errors (Mono, Lua and Node)

It’s kind of hard to intercept this kind of thing - a lot of crashes actually originate from external components and will exit by themselves.

Wouldn’t it make more sense to have some sort of backoff - if the monitored process exits and needs to restart more than X times in Y time period, simply considering it as failed and not automatically restarting after that? Most typical process managers already work like this, so it’s not a normally unseen scenario to handle restarts like this.

I’m more interested of detecting configuration problems vs real crashes.

So because FXServer can detect an invalid license, I feel that the exit code should be used.

For the others… I don’t know. As @argon said: