 |
 |
- Connect to (-and mount) an AppleShare server via CLI
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Mar 2001
Location: not far from my GSM phone
Status:
Offline
|
|
I wish to CRON the connection to an AS server each week (the server in question reboots automatically weekly, so I have to re-connect).
What command do I have to type to have my Mac connect and mount the server in the bg?
Thanx 4 help.
Greg
|
|
Lao_Tseu
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Nov 2000
Status:
Offline
|
|
To connect to an AFP server via the command line you use the command:
mount_afp "afp://[username:password]@rhost[:port]/volume" node
The [ ] indicate optional parameters. Volume is the name of the volume as shared on the server, and node is where the server should be mounted on the local machine. The command must be run as root as far as I know.
The problem with doing this that you will find is that although it will correctly mount the server and make it available through your filesystem, it won't cause it to be recreated on your desktop. You'd need to do something with Apple's Disk management framework, which as far as I know are not command line controllable, but I can't be sure they are not. Regardless, the Disk management frameworks may have a better way of mounting the disk, not calling mount_afp directly, but allowing it to call it by itself.
- proton
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Mar 2001
Location: not far from my GSM phone
Status:
Offline
|
|
Originally posted by proton:
To connect to an AFP server via the command line you use the command:
mount_afp "afp://[username assword]@rhost[ ort]/volume" node
The [ ] indicate optional parameters. Volume is the name of the volume as shared on the server, and node is where the server should be mounted on the local machine. The command must be run as root as far as I know.
The problem with doing this that you will find is that although it will correctly mount the server and make it available through your filesystem, it won't cause it to be recreated on your desktop. You'd need to do something with Apple's Disk management framework, which as far as I know are not command line controllable, but I can't be sure they are not. Regardless, the Disk management frameworks may have a better way of mounting the disk, not calling mount_afp directly, but allowing it to call it by itself.
- proton
Aliases allow to connect, mount and access network files. Is ther a way to do that via CLI?
Should I rther try an AppleScript?
greg
|
|
Lao_Tseu
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status:
Offline
|
|
Originally posted by lapinos:
Aliases allow to connect, mount and access network files. Is ther a way to do that via CLI?
Should I rther try an AppleScript?
greg
I don't think AppleScript will help even if it can do it - an AppleScript started by CRON will not be able to communicate with the Finder (or other UI stuff) since it has to be a childprocess of the process it is trying to communicate with.
BTW, the stuff above I picked up on these boards, and have never tried, so take it with a truckload of salt (or just try it).
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Nov 2000
Status:
Offline
|
|
Originally posted by lapinos:
Aliases allow to connect, mount and access network files. Is ther a way to do that via CLI?
Should I rther try an AppleScript?
greg
Well you can always attempt to open the alias via the open command. Just do open /path/to/alias/to/open. I'm not sure what would happen if it is run from cron, particularly if it isn't running as the same user as is logged in.
- proton
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Feb 2001
Location: BC, Canada
Status:
Offline
|
|
You could try using osascript at the command-line:
Code:
/usr/bin/osascript -e 'open location "afp://username:password@name.of.server/nameOfSharePoint"'
This will cause the sharepoint to mount in the finder. It will also be accessable at /Volumes/nameOfSharePoint
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Mar 2001
Location: not far from my GSM phone
Status:
Offline
|
|
Originally posted by grahamb:
You could try using osascript at the command-line:
Code:
/usr/bin/osascript -e 'open location "afp://username:password@name.of.server/nameOfSharePoint"'
This will cause the sharepoint to mount in the finder. It will also be accessable at /Volumes/nameOfSharePoint
grahamb, that's exactly what I needed. Just tried it in Terminal and it works.
Thank you!
Greg
|
|
Lao_Tseu
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Mar 2001
Location: not far from my GSM phone
Status:
Offline
|
|
Originally posted by grahamb:
You could try using osascript at the command-line:
Code:
/usr/bin/osascript -e 'open location "afp://username:password@name.of.server/nameOfSharePoint"'
This will cause the sharepoint to mount in the finder. It will also be accessable at /Volumes/nameOfSharePoint
This worked fine with a NT/afp server. Now I need to mount an OSX server share. With this command I cannot go beyond the use name screen. Is it possible to mount as guest directly?
thanx
|
|
Lao_Tseu
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Mar 2001
Location: not far from my GSM phone
Status:
Offline
|
|
I found the Solution:
It is a mix of the existing syntax with what I found typing "man mount_afp"
The result is:
/usr/bin/osascript -e 'open location "afp://;AUTH=No%20USer%20Authent@serveraddress/mountpoint"'
yessss
|
|
Lao_Tseu
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|