views:

56

answers:

5

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.

+1  A: 

Ask script developer about it

foret
should be a comment
SilentGhost
Nope, i don't think so. The answer is - every value != 0 is individual for every program -> so ask developer.
foret
+2  A: 

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.

ckk
+3  A: 

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.

Brandon Craig Rhodes
A: 

BSD tried to standardize exit codes, but it didn't (hasn't yet?) caught on:

sysexits3

JS
A: 

In this case, its unclear. foret's suggestion is one I would totally do if the developer is still around.

The Advanced Bash Scripting Guide lists some common exit codes with special meanings.

sheepsimulator