Skip to content

Include exit codes with the script #2

@gasconleon

Description

@gasconleon

Hello.

We are using this script from our monitoring stack. Normally, this kind of platforms expect an exit code to determine if the script has ended Ok (with exit status 0). It would be great if you could end the execution with and exit code in addition to the output text.

To show this, we have added the following code at the end of the script:

print result
if (result == "OK"):
    exit(0)
elif (result == "ERR_NET_NODE"):
    exit(1)
elif (result == "ERR_NET_STAT"):
    exit(2)
elif (result == "ERR_SYNC"):
    exit(3)

Best regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions