0

I'm setting up an OS X 10.4 Tiger Server box - just for the fun of it rather than for any serious purpose. I'd like to run a simple backup script daily, regardless of whether any user is currently logged in, and I'd like the script to have access to an AFP share (a USB drive connected to an Airport Extreme base station). So I'm trying to mount the share at startup rather than at user login. I can mount the share from the command line with:

mount_afp afp://username:password@servername/sharename/ /Volumes/sharename/

...where "servername" is the name of the base station rather than the server I'm setting up. That works fine. I haven't had any luck trying to make the system mount the share at startup, though. Being an ex-Linux user, I naively went looking for /etc/fstab so I could add an entry for the share, but the mount command doesn't seem to see my entry. To my surprise, I haven't been able to find any help on this either on apple.com or on the rest of the web. It seems like a very simple task; is there a standard way of doing this?

bythescruff
  • 101
  • 2

1 Answers1

1

It's probably simplest to create a StartupItem. Take a look at the ones in /System/Library/StartupItems for examples, as well as some useful scripting idioms (NFS is probably a particularly relevant example). Be sure to put your item in /Library/StartupItems (/System/Library is core OS components, /Library is for local customization).

You could also create a LaunchDaemon, which're intended to be replacements for StartupItems. In this case, however, that'd require you to do more work to control timing (i.e. make sure you don't try to mount the share point before the network's up).

Gordon Davisson
  • 11,036
  • 3
  • 27
  • 33