Posted on 10-26-2012 05:28 AM
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???
Solved! Go to Solution.
Posted on 10-26-2012 06:32 AM
Try running the script over AFP/SMB & not HTTP.
Posted on 10-26-2012 05:56 AM
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.
Posted on 10-26-2012 06:32 AM
Try running the script over AFP/SMB & not HTTP.
Posted on 10-26-2012 06:42 AM
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.
Posted on 10-26-2012 06:47 AM
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.
Posted on 10-26-2012 06:57 AM
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.
Posted on 10-26-2012 07:14 AM
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
Posted on 10-30-2012 10:14 AM
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!
Posted on 10-30-2012 11:50 AM
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?
Posted on 10-30-2012 01:51 PM
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.
Posted on 10-30-2012 04:06 PM
Script was created and edited in textedit - converted to plain text.
Server OS is 10.7.4
Posted on 10-30-2012 04:45 PM
Can you run the script locally, and get the proper http download?
What does the curl command above return to you?
Posted on 10-30-2012 05:25 PM
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>
Posted on 10-30-2012 06:00 PM
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?
Posted on 10-31-2012 07:07 AM
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
Posted on 10-31-2012 07:39 AM
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...
Posted on 10-31-2012 08:00 AM
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.
Posted on 10-31-2012 08:47 AM
Sorry, syntax slip there. It's the symlink that was auto created by the JSS during setup. I haven't changed it, honest ;-)