Using afp from within terminal

bpearcy

Registered
Hi, I'm trying to write a script that dumps some backup files across a network to a Mac running OS 9.0.4. Technically, I can do this manually by going through Aqua, and the Go > Connect to Server menu choice. This uses afp to connect to the computer, and then I can transfer information freely. But I want this to all be done from a shell script. Obviously, "curl" does not support afp as a protocal, so I can't use that... anyone have any ideas?

As I do this using Aqua, I can check my console.log file, which shows an entry:
userSelectedURL is afp:/at/Akira:*
where Akira is the name of the computer I'm connecting to.

I don't know if this contains any clues or not, but I'd love to find out if this CAN be done from the UNIX interface.

Thanks in advance!
 
try this in the terminal:
mount_afp
just type it, and onscreen help will appear.

You can automate this, once you figure out mount_afp by creating a shell script and running it from cron (unix command automator).

If you figure out how to manually use mount_afp but have trouble with the script and/or cron data, just let us know!
 
But I'm having some difficulties...

Okay, so I can use mount_afp to display the usage of it, but I can't seem to format my command just right. Everytime I try something, the console replies with a usage error, so it's obviously not connecting to the drive.

usage: mount_afp [-o option1[,option2...]]
afp://[username:password]@rhost[:port]/volume node

I type:
mount_afp afp://user:pass@Akira/

What are my options, and what is the volume node? Also, once I make the connection to the drive, how to I receive or send files to it?
 
Hi testuser,
I tried out exactly what you posted, and I'm not getting an error when I try the command anymore. But I don't think it is actually mounting anything. I cd into the node that I specified, and do a 'ls', and nothing shows up. So I'm wondering what I'm doing wrong.

It might be:
a) I'm trying to connect to a computer with a dynamic IP (served from DHCP)
b) I'm not entering the right value for the volume... I've just been trying my username. I don't know if that is right.
c) The computer is running mac OS 9.0, does this work when trying to communicate with the old OS?

Say I regularily connect to a computer with the name Akira, and I enter the username USER and the password PASSWORD, using the "Connect to Server" menu item, then to do this in UNIX I would enter:

mount_afp afp://USER:pASSWORD@Akira/USER /Volumes/Akira

right?

This function is very strange in the sense that there is absolutely no documentation on it out there...
Thanks again!
 
Ah-hah!
Finally... I tried connecting to a computer with a static IP and wa-lah, it worked. I'll look into this dynamic IP business, and see if I can get it to work. I saw some one mention elsewhere that mount_afp is about the sketchiest command they've ever seen, seemingly working and not-working, all at the same time!

Wow... what a day... it shall forever be remembered as "mount_afp Day, the Most Obscenely Wasted Day of All Time"...

(and on a side note, I'm a HUGE animé buff... well, more of a Japan buff, really. Anything Japanese peeks my interest... especially Mac OS X's support of Asian characters... Mmmm... asian characters...)

Well I've said enough I think...
 
I got the disk mounted when I look inside Terminal. But the
reset dosn't bring up the volume1!!!

Any idears???:confused:
 
Back
Top