|
|
#101 |
|
League Commissioner
Join Date: Mar 2003
Location: Bay Area, CA
Posts: 11,352
|
I edited my previous post and here is a link to the official documentation
http://developer.apple.com/mac/libra...stomLogin.html It explains the methods
__________________
sudo make me a sammich |
|
|
|
|
|
#102 |
|
Triple-A Player
Join Date: Jun 2008
Posts: 92
|
thanks for the suggestion but not even loginwindow manager worked. I made sure to set the executable bit on the script by entering the following command
sudo chmod a+x /Library/Scripts/loginscript.sh I hit the test button in loginwindow manager and the script executes and works great but when I log out and back in nothing happens. Arghh! |
|
|
|
|
|
#103 |
|
League Commissioner
Join Date: Mar 2003
Location: Bay Area, CA
Posts: 11,352
|
Did you read my link? You need to enable log in hooks in a plist for them to work, or have launchd do it.
Test that out and see what happens, if all else fails maybe after work hours I can get you on chat or something and try to figure it out
__________________
sudo make me a sammich |
|
|
|
|
|
#104 | ||||||||||||||||||||||||||||||||||||||||||||||
|
Hall of Famer
Join Date: Apr 2002
Posts: 3,315
|
The entire "mkdir" line is not needed, as all it does is add an extra folder into the mix. The original spec (as i recall) was to have an alias on the desktop... not an alias in a folder on the desktop. BTW, "ln -s" was suggested in post #73 back on March 5th (5 days ago).
FWIW, the "alias" command (shell builtin actually) got errors because -- to bash -- an alias is something totally different: it's a way to rename (or remap) a command (i.e., not an actual physical object in the filesystem which points to another). E.g., in my ~/.bashrc i have this line: alias sl='/bin/ln -sv' IOW, the text sl (SL) has now become a command for creating symbolic links. See 'help alias' for a brief description. Last edited by Hal Itosis; 03-10-2010 at 03:15 PM. |
||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
#105 |
|
Major Leaguer
Join Date: Jul 2003
Posts: 329
|
Hmmm....I have also tried the symbolic link method, here is the script:-
/bin/ln -s /Volumes/Staffh/$1 /Users/$1/Desktop/H_Drive This works perfectly when run by a user who is already logged on but it also fails when run during the logging on process. Here is the system log:- 11/03/2010 09:30:33 com.apple.loginwindow[757] 2010-03-11 09:30:33.462 loginwindow[776:203] *** NSTask: Task create for path '/Library/management/link_H_drive' failed: 22, "Invalid argument". Terminating temporary process. |
|
|
|
|
|
#106 |
|
Major Leaguer
Join Date: Jul 2003
Posts: 329
|
OK. Got it working as a launch agent.
I also found out that the $1 (currently logged on user) variable does not seem to get passed with launch agents so I went back to the AWK thinghy in the script. Here is the script (link_H_Drive) that the agent calls, it sits in a folder /Library/management:- #!/bin/sh me=$(ls -l /dev/console | awk '{print $3}') /bin/ln -s /Volumes/St*/$me /Users/$me/Desktop/$me"'s H Drive" Note the St* is because we have many staff volumes all depending on one's username but they all start with St. Users whose names start with G, would get mounted a volume called Staffg. Here is the launch agent plist (made with Lingon) which sits in /Library/LaunchAgents :- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>link H drive</string> <key>ProgramArguments</key> <array> <string>/Library/management/link_H_Drive</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist> |
|
|
|
|
|
#107 |
|
Triple-A Player
Join Date: Jun 2008
Posts: 92
|
hallelujah!!!!
This worked great! Thank you kaptagat. I can now customize this script to work with each building in our school district depending on the server share they are connecting to. I should also be able to easily push out the plist and script file via ARD so deployment should be simple. I was having trouble but figured out what I was doing wrong. I had the script named loginscript.sh, apparently OSX didn't like the .sh extension, I changed it to .scpt and it worked fine Thanks again! |
|
|
|
|
|
#108 |
|
Prospect
Join Date: Feb 2010
Posts: 20
|
Just to add another complication to this issue.
Using the info in this forum i have managed to redirect the documents folder so it points at the users AD home folder (using a Launchd agent and a script) Here is a look at our script: #!/bin/sh ls -l /dev/console | awk '{print $3}' TEST=$(ls -l /dev/console | awk '{print $3}') echo $TEST sleep 5 if [ -d /Volumes/mactest/$TEST ]; then mv /Users/$TEST/Documents /Users/$TEST/.Documents.bak ln -F -s /Volumes/mactest/$TEST /Users/$TEST/Documents else STRING1="User has no AD home folder" echo $STRING1 exit fi this script basically checks if the home folder exists, and if it does, renames the documents folder to .documents.bak folder and then creates a symbolic link called Documents which points at the users home folder. The problem is, that in our Active Directory environment, there could be a number of different locations for students home folders. example: home folders could be stored up on \\server1\studenthome\C0000001 (where C0000001 is the users home folder) In a different faculty it could be \\server2\students\class2010\C0000002 For each area in the college, there maybe between 30 and 50 different server locations that host home folders. Each Mac (when this is fully tested) will be binded to AD and a Mac server. on each mac client, the AD plugin is set to "Force local home directory on startup" so the users profile is created locally, but the documents folder is redirected to the users home folder in AD. So, the question is...Is there a way to get the AD home folder location (either from AD or from the OD server) and store this as a variable on the mac client so we can use it in a script? |
|
|
|
|
|
#109 |
|
League Commissioner
Join Date: Mar 2003
Location: Bay Area, CA
Posts: 11,352
|
palan
are you using the golden triangle method with OD and AD, or just AD by itself?
__________________
sudo make me a sammich |
|
|
|
|
|
#110 |
|
Prospect
Join Date: Feb 2010
Posts: 20
|
am using the golden triangle (both AD and OD)
|
|
|
|
|
|
#111 | |||||||||||||||||||||||
|
League Commissioner
Join Date: Mar 2003
Location: Bay Area, CA
Posts: 11,352
|
If you look at the key, NFSHomeDirectory in directory services it should display the full path to the user's home. I don't run AD so I can't test this. example Code:
dscl . read /Users/tlarkin | grep Home
__________________
sudo make me a sammich |
|||||||||||||||||||||||
|
|
|
|
|
#112 |
|
Prospect
Join Date: Feb 2010
Posts: 20
|
I tried running that command but it just returns
DS error: -14136 (eDSRecordNotFound) I have looked at the inspector tab within workgroup manager, and for each of our users the variable SMBHome contains the home folder address for each user, so do you know if it is possible to run a command in a script that will output this value? currently, this value is \\servername\share\classfolder\username, so we would probably need to parse this value so that all we were getting was \share\classfolder\username and we could use ln command to create a symbolic link from the users profile to point at their home folder. Do you know if its possible to even get this value from the server on the client? apologies for the never ending questions about this, and thanks for all your help so far |
|
|
|
|
|
#113 |
|
Prospect
Join Date: Feb 2010
Posts: 20
|
I posted too soon.
using dscl i have managed to just echo back the SMBHome location of the user that logs in. my question now is just how to take the info out of the value returned i.e. its in the form of \10.0.0.1\homes\classgroup\username i will need to take the value \homes\classgroup\username and make it look like /volumes/homes/classgroup/username so, basically drop the IP address or server name and change from back slashes to forward slashes. is this fairly easy to do with a script? |
|
|
|
|
|
#114 |
|
Triple-A Player
Join Date: Jun 2008
Posts: 92
|
I was able to pull the exact home folder path for one of my AD users by entering the command
dscl . read /Users/username SMBHome I would like to use this output in the login script so it creates a symbolic link to the SMBHome path. I tried several things but I keep getting syntax errors. Could anyone shed some light for me? |
|
|
|
|
|
#115 |
|
Major Leaguer
Join Date: Jul 2003
Posts: 329
|
You can pipe the output of the dcsl command to a file.
For example :- dscl . read /Users/abc1 SMBHome > home.txt The file then contains : SMBHome: \\CRWNSTAH1\Staffh\abc1 I thought about using AWK to extract each pice of data but that won't work because there are not any spaces in the line so no $1, $2, $3 etc. |
|
|
|
|
|
#116 |
|
Triple-A Player
Join Date: Jun 2008
Posts: 92
|
is there any way to make the output a variable that can be used to create a symbolic link?
The problem I am having is that the output shows the servername and uses backslashes instead of forward. I need to not only use the output to create a symbolic link but also convert the path into something the mac understands. Here are the steps I'm trying to accomplish, I just can't figure out how to do it via a script with my limited knowledge. 1. grab user's AD home folder path (Done using dscl . read /Users/username SMBHome) 2. take this output and convert it from \\servername\sharename\username to /Volumes/sharename/username 3. create a symbolic link to the home folder to the user's desktop Right now I am able to do this using the following script... me=$(ls -l /dev/console | awk '{print $3}') /bin/ln -s /Volumes/sharename/$me /Users/$me/Desktop/$me" 's Network Drive" The problem is I have to create a different script every single server we have. If I would be able to grab the user's home folder path using the dscl command it would allow me to create a universal script. |
|
|
|
|
|
#117 |
|
League Commissioner
Join Date: Mar 2003
Location: Bay Area, CA
Posts: 11,352
|
Can you show me the output of the dscl command with the SMBhome option? I don't have AD at work so I cannot reproduce
__________________
sudo make me a sammich |
|
|
|
|
|
#118 |
|
Triple-A Player
Join Date: Jun 2008
Posts: 92
|
sure, here is the output of the command dscl . read /Users/balboar SMBHome
SMBHome: \\hs3\classof2011\balboar |
|
|
|
|
|
#119 |
|
Major Leaguer
Join Date: Jul 2003
Posts: 329
|
I don't know awk but perhaps the way forward is to pipe the output to a file and use awk's find & replace function to find every \ and replace it with /.
Just a thought. |
|
|
|
|
|
#120 | |||||||||||||||||||||||
|
League Commissioner
Join Date: Mar 2003
Location: Bay Area, CA
Posts: 11,352
|
It doesn't mount it anywhere in /Volumes???
__________________
sudo make me a sammich |
|||||||||||||||||||||||
|
|
|
![]() |
|
|