What does process exit status 3 mean?

43,033

Solution 1

At least in the old days, a return value of 1 generally meant a hard error and value 2 was usually reserved for problems with the command line arguments — it meant that the user had made an error, not the program. But beyond that: no, no convention; and even that slight convention was not universal. Like dashes in front of command-line arguments, which some versions of ps(1) let you omit, return codes were just convention. In general, read the docs (or the source!) to the script you're running and you then have to write error-code checking code to its specific meanings.

Solution 2

There is no convention for non-zero values, they are commonly used to communicate the reason for termination and it's up to each application to define the mapping of error code and reason. In the case you're linking to you can clearly see a few lines above the check for exit code 3 that it is used to indicate that the code has changed.

Ie in this case this will give the behaviour that the automatic restart is done as long as the reason to terminate was that the code changed and nothing else.

Share:
43,033
deamon
Author by

deamon

Updated on October 23, 2020

Comments

  • deamon
    deamon over 3 years

    I've seen the usage of exit status 3 in several python scripts that restart processes. As far as I know the convention is only about 0 and "not 0" on Unix/Linux.

    Is there a convention defining other values like 3.