Skip to main content
Solved

Help with policy script


Forum|alt.badge.img+4

Hi all,

I'm having weird problems with the MountNetworkShare.sh . Nothing has been modified except to input the network path but it returns with:

/usr/sbin/jamf is version 8.62 Executing Policy Run Script mountNetworkShare.sh... Creating directory structure for /Library/Application Support/JAMF/Downloads/ Downloading http://<serveraddressremoved>:80/CasperShare/Scripts/mountNetworkShare.sh... Running script mountNetworkShare.sh... Script exit code: 2 Script result: /private/tmp/mountNetworkShare.sh: line 1: syntax error near unexpected token `newline' /private/tmp/mountNetworkShare.sh: line 1: `<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">'

It looks like it's converting it to a html doc and can't execute but why???

Best answer by bentoms

Try running the script over AFP/SMB & not HTTP.

View original
Did this topic help you find an answer to your question?

17 replies

Forum|alt.badge.img+7
  • Contributor
  • 44 replies
  • October 26, 2012

Can you post your script and just remove any sensitive data? Looks like either you uploaded the incorrect file or maybe didnt save it as a plain text file but its hard to know for sure with the given information.


bentoms
Forum|alt.badge.img+35
  • Legendary Contributor
  • 4331 replies
  • Answer
  • October 26, 2012

Try running the script over AFP/SMB & not HTTP.


leslie_h
Forum|alt.badge.img+14
  • Employee
  • 100 replies
  • October 26, 2012

Wonder what app you used to edit the script, if it embedded some html and also saved it with windows rather then Unix line endings. Would suggest editing the script with something like TextWrangler.


Forum|alt.badge.img+4
  • Contributor
  • 20 replies
  • October 26, 2012

Check the permissions of the file on the distribution point. Your clients are downloading it over HTTP and getting a 403 - Permission Denied web response from the web server servicing that point.


Forum|alt.badge.img+4
  • Contributor
  • 20 replies
  • October 26, 2012

Hint: Open Terminal and type:

curl http://<serveraddressremoved>:80/CasperShare/Scripts/mountNetworkShare.sh

What you see in your Terminal window is exactly what the Casper client is receiving and attempting to execute.


Forum|alt.badge.img+4
  • Author
  • Contributor
  • 14 replies
  • October 26, 2012

OK, when I curl it I'm told that it has moved to https
When I curl the https url I get:
curl: (35) error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol


Forum|alt.badge.img+4
  • Author
  • Contributor
  • 14 replies
  • October 30, 2012

Thanks to everybody for your help on this. Still don't know why it's flipping to https but switching it to ditto over AFP/SMB worked!


Forum|alt.badge.img+24
  • Valued Contributor
  • 1892 replies
  • October 30, 2012

Scripts should run fine over HTTP. Let's address root cause and not a band-aid. What did you open/edit the script with and what server OS is your JSS?


bentoms
Forum|alt.badge.img+35
  • Legendary Contributor
  • 4331 replies
  • October 30, 2012

As Jared says, my suggestion was merely a bandaid.

Next steps would be to test further to resolve the issue now you know the script is good & can be deployed.


Forum|alt.badge.img+4
  • Author
  • Contributor
  • 14 replies
  • October 30, 2012

Script was created and edited in textedit - converted to plain text.
Server OS is 10.7.4


Forum|alt.badge.img+13
  • Valued Contributor
  • 89 replies
  • October 30, 2012

Can you run the script locally, and get the proper http download?
What does the curl command above return to you?


Forum|alt.badge.img+4
  • Author
  • Contributor
  • 14 replies
  • October 31, 2012

The script runs fine locally.

Here's what I get when I try to curl the script:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://<serverremoved>/CasperShare/Scripts/mountNetworkShare.sh">here</a>.</p>
<hr>
<address>Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/0.9.8r DAV/2 Server at <serverremoved> Port 80</address>
</body></html>

Forum|alt.badge.img+24
  • Valued Contributor
  • 1892 replies
  • October 31, 2012

Do you have mod_rewrite rules or anything in a .htaccess file? A 302 redirect is totally not a normal thing unless it was setup on purpose.

I'm also wondering if you've got some squirreliness up in your httpd.conf file. Can you paste it here?


Forum|alt.badge.img+31
  • Honored Contributor
  • 2721 replies
  • October 31, 2012

Hi Everyone,

Just a thought here. On your web server (assuming Apache 2 here?) is the web docs folder linked to the actual CasperShare on the local server? When I set up HTTP distribution points I just usually use a symbolic link from the webdoc root in Apache to the actual local path on the Linux box where I typically set up my distribution points at.

Then, once that is verified, in the JSS > Settings > Servers > Distribution Point, under the HTTP tab ensure the context is set properly to the name of the share, in most cases called CasperShare.

I hope this helps,

Tom


Forum|alt.badge.img+4
  • Author
  • Contributor
  • 14 replies
  • October 31, 2012

Hi Tom,

This is a vanilla JSS build on a Mac OS X 10.7.4 server. I've checked that webDAV is not switched on for CasperShare and that the CasperShare alias is in /Library/Webserver/Documents (and links correctly!)

Regards,
Ger...


Forum|alt.badge.img+24
  • Valued Contributor
  • 1892 replies
  • October 31, 2012
the CasperShare alias

Woah, there it is. Did you say alias? Like, you created an alias in the Finder? That's likely your problem right there. Use a symlink or better yet, change DocumentRoot so it's actually pointed at the CasperShare folder.


Forum|alt.badge.img+4
  • Author
  • Contributor
  • 14 replies
  • October 31, 2012

Sorry, syntax slip there. It's the symlink that was auto created by the JSS during setup. I haven't changed it, honest ;-)


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings