To make a logout hook you need to make a shell script instead of a AppleScript. You can of course though utilize the shell command osascript to run AppleScripts from your shell script, but generally things on the system level are easily replicated in the terminal and a lot of the time with more options/power.
So one way to do this would be to make a shell script with the contens
Then save that .sh file somewhere and give it a chmod u+x
Finally set the logout hook
I would like to mention though that your applescript isn’t going to work because umount is not an actual command, so I assume you mean you have a shell command to do this in which case remove the osascript -e portion from the above bash command.
I admit to being new to sh scripting. I am using Scriptgui to test the app prior to creating it via Terminal. When I run the script below, I get the error: Operation not permitted.
#!/bin/bash
osascript -e ‘umount /Volumes/Art’
where “Art” is the network volume that I wish to unmount.
I think we are getting closer. I followed your suggestion
#! /bin/bash
diskutil unmount /Volumes/Art
& tried
#! /bin/bash
diskutil force unmount /Volumes/Art
but am getting this:
Disk Utility Tool
Usage: diskutil [mount(Disk)|unmount(Disk)|eject]
[Mount Point|Disk Identifier|Device Node]
Mount, unmount or eject local disks or volumes.
force is only valid on unmount or unmountDisk.
Example: diskutil unmount /Volumes/SomeDisk