Okay, so I have a simple shell script which I use as an application launcher that mounts some disk images that I use when running the application.
Once the application is finished the disk images are left mounted, so that if I want to relaunch the application the script can skip the mounting stage.
What I'd like to do however is built in a delay so that the disks will be unmounted say an hour after the application is closed.
I'm wondering what would be the best way to do this? Specifically, as the launcher script closes (because the app has been closed) I'd like to setup a delayed background action to trigger a second 'cleanup' script after a certain amount of time. I'd also like to be able to cancel that event from my launcher script (to prevent it from occurring while I'm running the application).
I was considering launchd, but it seems a bit of an awkward way to accomplish this since there's no good way to start a launch agent to execute after an hour or anything like that, which would possibly mean fiddling with the calendar interval via script or such.
Anyway, I basically just want the disks to unmount automatically X minutes after I finish using them, so I'd love to hear suggestions on how best to do this!
Once the application is finished the disk images are left mounted, so that if I want to relaunch the application the script can skip the mounting stage.
What I'd like to do however is built in a delay so that the disks will be unmounted say an hour after the application is closed.
I'm wondering what would be the best way to do this? Specifically, as the launcher script closes (because the app has been closed) I'd like to setup a delayed background action to trigger a second 'cleanup' script after a certain amount of time. I'd also like to be able to cancel that event from my launcher script (to prevent it from occurring while I'm running the application).
I was considering launchd, but it seems a bit of an awkward way to accomplish this since there's no good way to start a launch agent to execute after an hour or anything like that, which would possibly mean fiddling with the calendar interval via script or such.
Anyway, I basically just want the disks to unmount automatically X minutes after I finish using them, so I'd love to hear suggestions on how best to do this!