|
|
#81 | |||||||||||||||||||||||
|
League Commissioner
Join Date: Mar 2003
Location: Bay Area, CA
Posts: 11,352
|
Can you post your full script?
__________________
sudo make me a sammich |
|||||||||||||||||||||||
|
|
|
|
|
#82 |
|
Major Leaguer
Join Date: Jul 2003
Posts: 329
|
The script is in post 70. The "real" server share is studenth.
|
|
|
|
|
|
#83 | |||||||||||||||||||||||
|
League Commissioner
Join Date: Mar 2003
Location: Bay Area, CA
Posts: 11,352
|
so taking this info here...let me see if I can shed some light You have to have this run as a log in hook, by either using launchd to have it run at log in, or modify the loginhook.plist file to tell it to run the script and keep the script on the machines locally. This is what you did?
__________________
sudo make me a sammich |
|||||||||||||||||||||||
|
|
|
|
|
#84 |
|
Major Leaguer
Join Date: Jul 2003
Posts: 329
|
I am running the script with login window manager which runs all my other scripts perfectly. To test things I changed the script to alias a specific folder of the person logging on, so no $ variables are passed, and it still fails, the system log saying /Volumes/studhomeh/abc1 : no such file or directory.
This also happens when passing the $ variable, it looks for the correct users's folder but can't find it. When run by itself, from the terminal, the script works perfectly, so I think the problem is down to the logging on procedure is so quick that the system doesn't have time to open the mounted volume and scan the 100s of folders for the correct one to alias. |
|
|
|
|
|
#85 | |||||||||||||||||||||||
|
League Commissioner
Join Date: Mar 2003
Location: Bay Area, CA
Posts: 11,352
|
My guess is that the folder is not mounted yet and done so during log in. Try using the sleep command and make your script wait for 60 seconds and see if that makes any difference.
__________________
sudo make me a sammich |
|||||||||||||||||||||||
|
|
|
|
|
#86 |
|
Triple-A Player
Join Date: Jun 2008
Posts: 92
|
I've been playing around with this as well and it's giving me the same result "not found"
I do not think it's a timing issue. If I run the script manually after being logged in a while, it's still saying not found. I also has to change the command from mkalias to alias because the mkalias gave me a "command not found" message I think we're getting close though, it looks like it might be the format of the path or something simple |
|
|
|
|
|
#87 |
|
League Commissioner
Join Date: Mar 2003
Location: Bay Area, CA
Posts: 11,352
|
How is the folder being mounted then? If it worked before it was because you had it mounted previously to running the script. You can have it mount the share in the script with the mount command, but if you did not do that before how was it being mounted?
__________________
sudo make me a sammich |
|
|
|
|
|
#88 |
|
Triple-A Player
Join Date: Jun 2008
Posts: 92
|
The volume is being mounted at login and is called ECSERVER, here is the command I'm trying to run manually and in the script. ECSERVER is mounted on the destkop as I run the command.
alias /Volumes/ECSERVER/lenhartj /Users/lenhartj/Desktop/H_Drive Output: -bash: alias: /Volumes/ECSERVER/: not found -bash: alias: /Users/lenhartj/Desktop/H_Drive: not found If I run the command with mkalias the output reads "mkalias: Command not found" is my syntax incorrect? |
|
|
|
|
|
#89 |
|
Triple-A Player
Join Date: Jun 2008
Posts: 92
|
just a follow up, if I run the command ls /Volumes/ECSERVER/lenhartj it works fine and lists the contents of my folder
|
|
|
|
|
|
#90 |
|
League Commissioner
Join Date: Mar 2003
Location: Bay Area, CA
Posts: 11,352
|
can you run this command and post the output?
ls -al /Volumes Do it though after the share is mounted so we can see the mount point.
__________________
sudo make me a sammich |
|
|
|
|
|
#91 |
|
Triple-A Player
Join Date: Jun 2008
Posts: 92
|
Sure thing, here is the output, looks like ECSERVER is in the list
TECH-IMAC:~ admin$ ls -al /Volumes total 8 drwxrwxrwt@ 4 root admin 136 Mar 10 09:49 . drwxrwxr-t 36 root admin 1292 Jan 14 12:35 .. drwx------@ 112 admin staff 3764 Mar 8 08:01 ECSERVER lrwxr-xr-x 1 root admin 1 Mar 8 15:08 TECH-IMAC -> / TECH-IMAC:~ admin$ |
|
|
|
|
|
#92 |
|
League Commissioner
Join Date: Mar 2003
Location: Bay Area, CA
Posts: 11,352
|
Try using the mkdir command to make the directory first for h_drive, then either alias it or use a symbolic link (ln -s). I mean we need to do it step by step to find out the missing step or location of failure, that way we can script it. You said it worked once, but nothing has changed and now it doesn't?
__________________
sudo make me a sammich Last edited by tlarkin; 03-10-2010 at 10:30 AM. |
|
|
|
|
|
#93 |
|
Triple-A Player
Join Date: Jun 2008
Posts: 92
|
this worked great! I used the following and it mapped a folder with an alias inside of it to my network home.
mkdir /Users/$me/Desktop/H_Drive ln -s /Volumes/ECSERVER/$me /Users/$me/Desktop/H_Drive The only problem is I can't get the script to run using WGM. I added my imac in a test user group, then added this as a login script in Preferences>Login>Scripts I logged in as me and nothing happened, is there some MCX refresh I need to perform? |
|
|
|
|
|
#94 |
|
League Commissioner
Join Date: Mar 2003
Location: Bay Area, CA
Posts: 11,352
|
In WGM, only computer groups can run log in hooks, not user groups. So you would have to create computer groups to do so.
Another way is to modify the loginhook.plist file and have it run the script, another way would be to have launchd run it from /Library/LaunchAgents, which will run anytime any user logs in.
__________________
sudo make me a sammich |
|
|
|
|
|
#95 |
|
Triple-A Player
Join Date: Jun 2008
Posts: 92
|
how can I run it from /Library/LaunchAgents
I dropped the script in that folder but nothing happens, could you tell me what I'll need to do to get launchd to run it at login? |
|
|
|
|
|
#96 |
|
Major Leaguer
Join Date: Jul 2003
Posts: 329
|
Lennysweet:
Your mkalias command not found is caused because the path to the command is missing. I had to put the full path as below when running the command from a script:- /usr/local/bin/mkalias /volumes..... I use Mike Bombich's LoginWindow Manager to launch scripts at login and logout. It is quite old now and complains about fonts when you start it up but it still works right up to 10.6. tlarkin : Adding a sleep period didn't make any difference. Last edited by kaptagat; 03-10-2010 at 11:24 AM. |
|
|
|
|
|
#97 |
|
Triple-A Player
Join Date: Jun 2008
Posts: 92
|
the ln -s is working fine, my problem now is I can't seem to get it to run at login. Could you give me details instructions for getting this script to run for any user who logs in?
|
|
|
|
|
|
#98 |
|
League Commissioner
Join Date: Mar 2003
Location: Bay Area, CA
Posts: 11,352
|
create a luanchd agent like so:
Code:
<?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>com.mycompany.loginhook</string> <key>ProgramArguments</key> <array> <string>/Library/Scripts/myloginscript.sh</string> </array> </dict> </plist> Then use launchctl to load your launchd item permanently. (run as root) Code:
sudo launchctl -w load /Library/LaunchAgents/com.mycompany.loginhook.plist Now anytime, any user logs in, it will run. You can also modify the local file /Library/Preferences/com.apple.loginwindow.plist to have it run the script as well. If you import computer names into WGM you can manage it by computer groups, or create a guest computer and assign it that way. However, a guest computer will get assigned to all macs in your deployment, as it is the default computer for all computer groups. ---EDIT---- I went back and outlined what you would have to fill in for your settings. After it is loaded you may have to reboot to get the agent to run. To ensure it is running you can use launchctl list command to see if your agent is listed. I have used this method in the past at my work and it has worked for me for automating scripts.
__________________
sudo make me a sammich Last edited by tlarkin; 03-10-2010 at 12:15 PM. |
|
|
|
|
|
#99 |
|
Triple-A Player
Join Date: Jun 2008
Posts: 92
|
Wow, that's quite a process. I tried it and of course, it didn't work for me. When I ran the launchctl command with -w argument it said it could not be found. I removed it and got a "dubious ownership" error.
At this point I pasted the text into a file and named it com.rlasd.loginhook.plist and saved it into the Launchagents folder. I then save the the script named loginscript.sh into the scripts folder. I made sure all of the paths were correct so I'm not sure what I'm doing wrong. Why does something as simple as a login script take so much command line knowhow geez! |
|
|
|
|
|
#100 |
|
Major Leaguer
Join Date: Jul 2003
Posts: 329
|
Lennysweet:
Use loginwindow manager. It is very simple, you just drag your script into a run shell script at login box, tick the box and tick apply. Nothing could be simpler. It is also free. |
|
|
|
![]() |
|
|