1

I'm using OS X as a Server, running Server.app 4.0 to provide email hosting/etc.

Attached to this machine I have a PROMISE Pegasus R2 RAID drive mounted at /Volumes/RAID6-11TB, and I changed the default service storage location so that the Server.app data would be located on the RAID drive (for redundency, and so that Backblaze can backup my precious email, which normally ignores /Library).

The problem is when rebooting the machine, Server.app doesn't properly startup, because something during the boot process is creating an empty directory /Volumes/RAID6-11TB/Library/Server/Web/Data/Sites/Default/NetBoot. When the RAID array is later automagically mounted, it's default mountpoint already exists, so it is instead mounted at /Volumes/RAID6-11TV 1, which causes no good at all.

Is there a way to fix rebooting so that either:

  1. Server.app won't launch until the RAID disk is ready, or
  2. Delay OS boot so that it won't finish launching until the RAID disk is ready?

Regarding (1), I've edited /Library/LaunchDaemons/com.apple.serverd.plist to add a QueueDirectories key, but that doesn't seem to have any effect, and WatchPaths sounds like it has the wrong semantics, so I'm leery to even try that.

Regarding (2), if I boot into Single User mode (holding down Command+S during boot), then wait until all messages have completed, then hit Ctrl+D to continue the boot, /Volumes/RAID6-11TB is properly mounted as intended.

However, this doesn't help for automated reboots when I'm away (e.g. after power failures). (OK, the "proper" answer is battery backups so that the machine doesn't reboot, but let's ignore that for now...)

Is there some way to make this work?

  • do you use nfs or http for netboot? – klanomath Dec 17 '14 at 20:21
  • @klanomath I'm not using netbook at all, and AFAICT I've disabled netbook within Server.app, so I'm not sure why it's trying to create that directory in the first place... – jonp Dec 18 '14 at 19:36
1

It's Server.app that is creating that mysterious folder that's gumming up your works.

Stop the Server.app from launching when the server boots, and then you can create a cronjob that launches it via a .sh script.

Script should just be something like

#!/bin/bash
/Applications/Server.app

and like the person said in the one link, the cronjob entry would be something along the lines of

@reboot sleep 60 && my_script.sh

That should give your RAID enough time to mount properly before Server.app pops up and creates that folder.

1

I split the difference with @zomgdavidbowie: I created a new script /usr/local/bin/start-server-app:

#!/bin/sh

sleep 120

exec /Library/PrivilegedHelperTools/com.apple.serverd

I then edited /Library/LaunchDaemons/com.apple.serverd.plist and replaced all instances of /Library/PrivilegedHelperTools/com.apple.serverd with /usr/local/bin/start-server-app:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.apple.serverd</string>
    <key>MachServices</key>
    <dict>
        <key>com.apple.serverd</key>
        <true/>
    </dict>
    <key>OnDemand</key>
    <false/>
    <key>Program</key>
    <string>/Library/PrivilegedHelperTools/com.apple.serverd</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Library/PrivilegedHelperTools/com.apple.serverd</string>
    </array>
</dict>
</plist>

This allows me to stay with the default launch mechanism without delving into cron(8), while still delaying the com.apple.serverd invocation until after the external drive has been mounted.

0

How about this, instead of just waiting, do the following:

#!/bin/sh

if [[ ! -e /Volumes/<volname ]]; then
sleep 60
else
exec /Library/PrivilegedHelperTools/com.apple.serverd
fi
exit 0

This should check if you volume is exists, if no, wait 60 seconds, if yes, start the server app.

  • Good idea, though in my experience the volume is never immediately available at startup, so the sleep would be hit anyway... – jonp Apr 21 '15 at 13:39
  • @jonp do you know if the /Library/LaunchDaemons/com.apple.serverd.plist gets over written when Sever.app is updated? – Kemo Apr 26 '15 at 11:05
  • Yes, it is overwritten when Server.app is updated. Keep a backup copy so you can easily replace it when Server.app is updated. – jonp Apr 27 '15 at 13:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .