Hello,
We currently are using Casper 7.2.1 with a Mac OS 10.5.2 client computer.
I am having problems deploying bash scripts we created for use through
Casper policies. The purpose of the scripts are to check whether a
reboot is required by the an apple update, and if a reboot is required
run an applescript which displays a custom graphic for our organization
and give the user a notification that the computer will reboot in 1
minute after they click the ok button. I know that this capability is
available through casper policy, but we wanted to display an alert
dialog box with our organization graphic so the user may trust it more
and not think its a virus or some other malware. I tested the scripts and they run fine
locally on the machine. However when they are run through policy we get an error like below. We had a script that worked
successfully on a separate policy, however when we added the two scripts
I have attached to the email that script stopped working. Then we
removed those two scripts from the policy and the script that was
working still does not work. The script that was working was named
test1.sh.
The errors we get when using the jamf -policy trigger command to manually trigger the policy
Mounting afp://tray.arl.army.mil/CasperShare to /Volumes/CasperShare... Running Script test1.sh... Script Exit Code:127 Script Result: sh: /private/tmp/test1.sh: No such file or directory
Running Script preRebootScript.sh... Script Exit Code:127 Script Result: sh: /private/tmp/preRebootScript.sh: No such file or directory
Running Script postRebootScript.sh... Script Exit Code:127 Script Result: sh: /private/tmp/postRebootScript.sh: No such file or directory
Here are the contents of each script.
preRebootScript.sh
1 #!/bin/sh
2 #This script should run prior to the updated
3
4 wc /var/log/jamf.log | awk '{ print $1 }' > /tmp/lineCount
5
6 #echo "I created the linecount File"
postRebootScript.sh
1 #!/bin/bash
2 #This script should run prior to the updated
3
4 lineCount=cat /tmp/lineCount | awk '{ print $1 }'
5 flag=""
6
7
8 flag=`sed -n "$lineCount,$ s~reboot was required~&~p"
/var/log/jamf.log | a wk '{ print $8 }' | head -n 1`
9
10
11
12 if [ "$flag" = "reboot" ]
13 then
14 #echo "I am running the reboot app"
15 open /usr/local/AppleScript/reboot_really_1.app
16 fi
This script used to work
test1.sh
1 #!/bin/sh
2
3 touch /tmp/script_ran
Also I tested the scripts by running locally on the machine using the jamf runScript command and everything worked fine. But when the scripts are initiated through casper policy we get the errors like above.
Any help would be appreciated.
-- David Bruno