Three years ago to this question and a reminder from the end of March this year. Ok, I will bite.
In general, the shell script ends with the exit code you want. Therefore, if your script contains:
exit 127
This will probably be the reason for the exit code.
However, certain exit codes are standard, and it is generally considered bad to use them. (the table below is not exhaustive)
+----+--------------------------------------------------------+ | 1 | Catch-all for general errors, eg divide by zero etc. | +----+--------------------------------------------------------+ | 2 | Misuse of shell build-ins | +----+--------------------------------------------------------+ | 126| Cannot execute command invoked | +----+--------------------------------------------------------+ | 127|Illegal command/command not found | +----+--------------------------------------------------------+ | 128|Illegal argument to exit (eg exit 3.14) | +----+--------------------------------------------------------+
So, if there is no exit 127 in the script, this is probably an illegal command. Does /bin/sh exist? (sounds trivial, but I saw systems where they do not exist). What does the script say when starting manually?
source share