I have a problem with 2 brand new G5s running a server mounting script at startup on X.3.3. Basically, the users need about 10 Win2k server volumes mounted at startup. Prior to OS X, simple aliases in the Startup Items folder would have done it. In OS X on G4s, a nice Applescript did it. Now, however, this same script fails at startup on G5s because it seems that the script attempts to run BEFORE the network subsystem is even ready. If the users wait about 30 seconds after boot time, they can double-click the script and all server volumes mount fine…has anyone else run into this kind of problem?
I’ve tried everything, including clean OS installs, clearing PRAM, the whole shebang. Now, I’m possibly looking into modifying the script, although I’ve already tried adding a 30 second delay at the beginning of script execution. All it does is delays the network startup as well and gives me a server error failure… If I double-click the script after this manually, it will mount fine…
Any help would be greatly appreciated…thanks!
Here’s the script I’m working with:
delay 30
tell application "Finder"
mount volume "smb://user:pass@10.0.0.1/a"
mount volume "smb://user:pass@10.0.0.1/b"
mount volume "smb://user:pass@10.0.0.1/c"
mount volume "smb://user:pass@10.0.0.1/d"
end tell
How are you invoking this script? Is it part of a user’s login items? If so the network should definitely be up by the time it’s run.
If you want the server volumes mounted at startup for all users you’d be better off creating a startup item and having the script run during startup. You can use the standard startup item controls to make sure it loads after the network is initialized.
Sorry, yes it’s invoked as an application in Login Items. Worked fine for the G4s, not these G5s, which is what is odd.
All machines are single user only, but could you toss an example startup item my way using those standard startup item controls? Thanks for the response!
Just an assumption. I suppose it could be the Finder that’s not ready. What happens is the Desktop will come up, menu bar will come down, the Script (as an app) will run greyed out and there are no Desktop icons. Any delay less than 60 will return an error. During this delay and while the script is open, it has total control of the machine although I can hear disk activity.
I have increased the delay to 60 and now it works fine–all servers mount, although waiting a minute to startup in order to mount servers kinda defeats the purpose of a fast boot…
At any rate, any delay lower than 60 causes an alert to popup with -36 (I believe this is an SMB error?) and the option to Edit or Cancel the script. However, if I cancel the script and then open the same script app, it will mount the volumes. If I click Edit, the Script Editor opens and I can click Run and it will mount the servers as well…very strange.
Have you tried the code without involving the Finder? The ‘mount volume’ command is not in Finder’s dictionary - it belongs to the Standard Additions osax (in OS X anyway).
mount volume "smb://user:pass@10.0.0.1/a"
mount volume "smb://user:pass@10.0.0.1/b"
mount volume "smb://user:pass@10.0.0.1/c"
mount volume "smb://user:pass@10.0.0.1/d"
tell application "Finder"
mount volume "afp://user:pass@server_address/sharepoint"
end tell
and it works just fine, running 10.3.3.
just for kicks, mount the server and then add it to your account’s startup items (system prefs → accounts → your account → startup items tab). then reboot and see if the server mounts at startup and gets you a server login screen.
I’ll bet a stack of scripts that it will also work just fine without being wrapped in a Finder blanket. When code is wrapped in a Finder block and the code doesn’t actually belong to Finder, it can sometimes cause strange things to happen. This is one of the reasons that I prefer to keep unrelated code outside of application specific code blocks whenever possible.