Policy Errors when running scripts

adroitboy
New Contributor III

I think this will be something simple.

I frequently have policies that run scripts and It seems that I get a lot of policy errors even though the script exit code is 0. It seems that the jss does not expect any output from the script in the "Script Result", and if it gets it, it will report an error. I would want it to report an error if the script exits with a code other than 0.

Anyone care to explain what I'm doing wrong and what I should do?

Here's a partial example of a JSS policy error e-mail I get.

An error occurred executing the policy "Run Script netrenderzombie_c4dr13.sh" on the computer "2939-mp".

Event log from the policy:

    /usr/sbin/jamf is version 8.51
    Executing Policy Run Script netrenderzombie_c4dr13.sh...
    Mounting afp://jss.company.com/CasperShare to /Volumes/CasperShare...
    Running Script netrender_c4dr13.sh...
    Script Exit Code:0
    Script Result: Creating user netrender...
Sat Aug 18 19:43:59 2939-mp.company.com osascript[4866] <Warning>: 3891612: (connectAndCheck) Untrusted apps are not allowed to connect to or launch Window Server before login.
Sat Aug 18 19:43:59 2939-mp.company.com osascript[4866] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
2 REPLIES 2

acdesigntech
Contributor II

Applescript scripts will fail if there is not a a console user logged in. It has nothing to do with output from the script.

adroitboy
New Contributor III

These are all shell scripts. Even something like curl'ing and unzipping a folder causes an error. I'm thinking I could just redirect all output to /dev/null, but I'd really like to know why a script run through jamf shows as an error even when it exits with a status of 0.