RAID Volume Mount Not Detected Only After Restart

When I restart Catalina I have a SoftRAID volume that automatically mounts. When that happens, I want to mount an encrypted volume on it. I have a Global Macro Group macro to detect this and execute a shell script. However, KM is not detecting that this volume has mounted. It's triggered by This volume: with exact name RAID5-5x8TB is mounted. I have a Speak Text as the first action before the shell script to mount the encrypted volume. Neither execute.

I checked the Engine.log file and there is no indication that the macro has run. I know the macro is formed correctly because if I manually unmount the RAID and then use SoftRAID to mount it again, the macro runs. It just doesn't run after restart.

Is the correct way to do this to create a shell script that runs at restart, pauses, and then runs the macro?

Hey Tom,

When you restart your Mac I reckon that volume is getting mounted long before Keyboard Maestro starts up, so there's no way the trigger could act.

You'll have to work around that, and I can't think of a better way than a startup script at the moment.

-Chris

2 Likes

Hey Tom,

Just thinking out loud here...

What I might do for simplicity is:

  • Run a script that writes a file on system startup named STARTUP_TRUE.
     
  • Have an Engine Launch Triggered macro that looks for that file when the Keyboard Maestro Engine starts up.
    • If the file exists:
      • Deletes the file.
      • Checks to see if the drive is mounted.
      • Does its thing.
        • Perhaps runs the on-mount macro.

-Chris

I think there's going to be some trial & error testing to determine which starts first. I could invoke the KM macro directly from the startup script, but only if the engine is already running. Or, I can invoke the mount command for the encrypted volume from within the shell script, but that assumes the RAID volume is mounted, otherwise I have to have a delay loop. I thought this was going to be a lot easier. :slightly_smiling_face:

Good point.

If you're going to run your script as a Startup Item then you have control over that – although it's a pain to rearrange startup-items.

You should be able to just drag and drop to rearrange them, but alas Apple frequently doesn't listen (we've asked for this since MacOS 8 or so).

Do you want to mount the encrypted volume before you log in, or after?

I'm thinking just add a login trigger to your current macro, and add at the beginning a "Pause until...mounted volume" action then an "If encrypted volume is mounted then Cancel this macro" action.

That should (totally untested!) account for most cases -- restart, log out and back in, and the (very unlikely, but strange things happen!) times when you've logged in before the SoftRAID volume has mounted.

1 Like

After login. I’ll definitely check that out. Even if the RAID isn’t mounted, I should be able to wait for it. Thanks.

You should never have to wait for it, the pause is just there in case of problems (you probably want to include a time-out and cancel-with-alert in case your RAID is ever frazzled!) and for if there's a delay in it appearing in your user-space (again, shouldn't happen but I've seen strange timing issues with large volumes making contents available after login).

1 Like