network music storage and macos annoyances

For a long time I’ve kept my music on a network accessible drive in the house.  I started to do this because I had multiple computers I actively used and wanted to access it in a central location.  The FreeBSD machine served up NFS and SMB to the machines that needed it, and it worked fine.

Eventually I got a couple Squeezeboxes and needed it to stay on that server so I had place to run the server for playing music.  I even wrote a perl script that used MP3::Info to confirm various "minimum requirements" for quality in the music I stored, and even confirmed that the ID3 tags matched the filenames and directory structures.

More recently I decided that managing album art, ID3 tags, and synching the music quickly and reliably meant switching to iTunes.  BUT, I had no desire to switch away from the network share method.  This is because I still needed to host the music for the Squeezeboxes.  I have a 500GB drive hooked up to my iBook G4 that serves as my backup server (Time Machine / rsync depending on OS), so I just added a partition to that for the music and set it all up.

Things worked absolutely great.  Sure, I noticed some delay in big updates in the music or apps on my iPhone, but they were relatively minor in the scheme of things.  

I did have some problems with my laptop going to sleep though.  Sometimes my MacBook would wake up from sleep and forget the network share.  This meant a minor inconvenience of telling iTunes where to find its folders, and by navigating to the right location, remounting the drive.  It’s even pretty easy to create an alias to the mount point on your desktop and just double click on it to re-mount the share.  I wish MacOS would handle that better, but it was life..

That is.. except when I was actually running iTunes and I put my laptop to sleep.  iTunes would crash when it realized it had lost its data.  Not only would it crash, but it would spin out of control, eating massive amounts of CPU and make it a pain in the butt to even kill off.

I was finally able to solve the problem tonight.

First, I installed SleepWatcher from  – this application allows for the execution of commands from the cli on sleep or wake up from sleep.

I installed both the daemon and the startup package and rebooted my machine (needed to do some software updates anyways).

Next, I copied some basic scripting from this (mostly) unrelated blog entry;

and came up with;


function doMounts {
  mnt_cnt=$(/sbin/mount | grep -ic "/Volumes/$vol")
  if [ $mnt_cnt -le 0 ]; then
    /usr/bin/osascript <<EOT
    tell application "Finder" to mount volume "afp://myiBookG4/$vol"

for (( i=0; $i < 12; i++ ))
  doMounts iTunes\ Library
  sleep 5

exit 0

Since it will sometimes take the OS a few seconds to realize it has lost the share, or even more to reinitialize all the hardware if it actually hibernated, I told it to look to see if the mount was there on a 5 second interval for a minute.

I’ve tested it a few times, and it re-mounts the network share with great reliability..  Hopefully this solves all the annoyances above.

Now.. Apple.. I shouldn’t have to do this.  Please fix it!

One thought on “network music storage and macos annoyances

  1. Ann

    Every time I read about how you fix things and make your life marvelously easy I feel like genuflecting and bowing down to your greatness. I, a mere mortal, wish I could understand, let alone do the things you describe here.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s