So I have an encrypted disk image that I use to store sensitive files. However, I often forget to eject it when I'm done, which obviously negates the whole point of encryption. What I'd like is some tool, setting, etc. (perhaps a cron job?) that monitors when a specific disk image is mounted, waits a specific duration of time, and then displays a message notifying the user of imminent ejection. If the user does not opt to reset the timer, or doesn't respond, the image is ejected. Alternatively, it could also eject when the screen saver activates. Do any tools like that exist?


You can use a cronJob and an apple Script

unMount a disk with AppleScript :

set mountedDiskName to "AirPort Time Capsule"
set diskIsMounted to false

tell application "System Events" to set diskNames to name of every disk
if mountedDiskName is in diskNames then
    set diskIsMounted to true
end if

if diskIsMounted then

    //  put a sleep or a notification here, see explanation below

    log "Disk Found, unmounting now..."
    do shell script "diskutil unmountDisk" & space & quoted form of mountedDiskName


    log "Disk Not Found, mounting now…"
    mount volume "afp://AirPort%20Time%20Capsule._afpovertcp._tcp.local"

end if


Make a cronJob to run the Script :

* * * * * osascript ~/Desktop/theScriptToBeExecuted.applescript

How can I configure my computer to run an AppleScript at a specific time? Caveat: without using iCal

Put a sleep or a notification in "if diskIsMounted", because if you mount your disk at the cronTab start, your disk will be ejected before the end of your backup ;)

**I provide you a simple idea and some code to help you, you will certainly have to modify some code.

You must log in to answer this question.

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