Script runs from secondary server, but not from master

wdpickle
Contributor

I have "borrowed" my first script, thanks Rob, and started to learn how to do things the easy way. This script counts the number of cycles on the battery. My issue is that the script runs on MBPs that are on network segments pointing to a secondary server after syncing to the master:
Downloading http://macserverwc02.school.org:80/CasperShare/Scripts//battery.cs...
Running Script battery.cs...
Script Exit Code:0
Script Result: <result>31</result>

but for machines on the segments pointing to the master the script is failing with:

Downloading http://macserverwc01.school.org:80/CasperShare/Scripts//battery.cs...
Error: The script could not be found on the server.

What am I missing?

1 ACCEPTED SOLUTION

wdpickle
Contributor

Reading a discussion on a similar topic, I saw a suggestion to check the box to "Force Distribution Points to use AFP/SMB instead of HTTP" which seems to have resolved this issue.

View solution in original post

9 REPLIES 9

wdpickle
Contributor

Reading a discussion on a similar topic, I saw a suggestion to check the box to "Force Distribution Points to use AFP/SMB instead of HTTP" which seems to have resolved this issue.

jarednichols
Honored Contributor

This bandaid stinks. Let's find root cause.

What kind of server is your secondary? If it's Windows and you're running IIS, not including the proper MIME-type is a dead giveaway for "not found" 404 errors.

wdpickle
Contributor

Both the primary and the secondary servers are Mac mini OS X 10.7.5

jarednichols
Honored Contributor

How are you replicating from your primary to your secondary? Is the file actually present on the secondary? If it's present, it points to a permissions issue.

wdpickle
Contributor

To replicate we go to Casper Admin click on the "target" server and click on replicate. It works from the secondary, not from the master. I have checked to make sure the file on the master and the secondary have Read Only rights for everyone.

mm2270
Legendary Contributor III

Are you able to 'curl' down the file from the share on the primary from one of the Macs that is getting those errors?

Try doing something like this-

curl -v http://macserverwc02.school.org:80/CasperShare/Scripts/battery.cs

You should see the script contents display in the Terminal window. You could also add the following to the end of the command to save the script as a file locally-

-o ~/Desktop/battery.cs

wdpickle
Contributor

To duplicate the issue, I unchecked the force to afp/smb and set the default server for my segment to macserver01.
I did the curl (copied and pasted the line, thank you) and got:

Last login: Thu Nov 1 16:23:25 on console
BPSS-0000:~ administrator$ curl -v http://macserverwc02.school.org:80/CasperShare/Scripts/battery.cs
About to connect() to macserverwc02.school.org port 80 (#0)
Trying 74.117.114.76... connected
Connected to macserverwc02.school.org (74.117.114.76) port 80 (#0)
> GET /CasperShare/Scripts/battery.cs HTTP/1.1
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
> Host: macserverwc02.school.org
> Accept: */*
> < HTTP/1.1 302 Found
< Date: Thu, 01 Nov 2012 21:25:28 GMT
< Server: Apache/2.2.3 (CentOS)
< X-Powered-By: PHP/5.2.11
< Location: http://macserverwc02.school.org?fof=Y
< Vary: Accept-Encoding,User-Agent
< P3P: CP="CAO PSA OUR"
< Cache-Control: no-cache, no-store, must-revalidate, post-check=0, pre-check=0
< Pragma: no-cache
< Expires: Mon, 31 Dec 2001 7:32:00 GMT
< Content-Length: 0
< Connection: close
< Content-Type: text/html; charset=UTF-8
<
Closing connection #0
BPSS-0000:~ administrator$ -o ~/Desktop/battery.cs
-bash: -o: command not found

the save to a file didn't work so i copied and pasted.

bentoms
Release Candidate Programs Tester

Hang on, was the above tested on 02 only? Can you try 01?

Also, I have you recreated the symlink for the CasperShare?

http://macmule.com/2012/04/11/error-the-package-does-not-appear-to-be-on-the-server-400-line-1-synta...

wdpickle
Contributor

OK, I have finally stopped the "brush fires". I ran the curl on serv1 and got:
Closing connection #0
BPSS-0000:~ administrator$ curl -v http://macserverwc01.school.org:80/CasperShare/Scripts/battery.cs
About to connect() to macserverwc01.school.org port 80 (#0)
Trying 74.117.114.76... connected
Connected to macserverwc01.school.org (74.117.114.76) port 80 (#0)
> GET /CasperShare/Scripts/battery.cs HTTP/1.1
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
> Host: macserverwc01.school.org
> Accept: */*
> < HTTP/1.1 302 Found
< Date: Fri, 02 Nov 2012 18:43:30 GMT
< Server: Apache/2.2.3 (CentOS)
< X-Powered-By: PHP/5.2.11
< Location: http://macserverwc01.school.org?fof=Y
< Vary: Accept-Encoding,User-Agent
< P3P: CP="CAO PSA OUR"
< Cache-Control: no-cache, no-store, must-revalidate, post-check=0, pre-check=0
< Pragma: no-cache
< Expires: Mon, 31 Dec 2001 7:32:00 GMT
< Content-Length: 0
< Connection: close
< Content-Type: text/html; charset=UTF-8
< * Closing connection #0
BPSS-0000:~ administrator$

interesting point ( at least to me) when this machine logs out it uses macserver01 and fails, but when it logs in it uses macserver02 and works (as shown in the policy history).