How to trigger a script when unmounting a hard drive or restarting?

2

1

I've recently installed NTFS-3G through Homebrew in order to access NTFS drives from OSX. There's a slight problem with it: after unmounting the drive, if you take a look at /Volumes/, you can still find the unmounted volume folder there. That's why when I mount the drive back in, it appears under the same name with a number following +1 every time I do this.

I can make a script to delete din folders, but I don't know how to trigger it when the drive is being unmounted or at least how to trigger it when the system restarts/shuts down.

Any ideas on how I could do that?The folders from the external hard drive

Mihai Neacsu

Posted 2012-12-23T14:22:06.117

Reputation: 225

Answers

1

The solution I found is running the script at shutdown with this:

sudo defaults write com.apple.loginwindow LogoutHook /usr/scripts/myScript.py

Mihai Neacsu

Posted 2012-12-23T14:22:06.117

Reputation: 225