[launchd-dev] Launch shell script when volume is mounted
Jerry Krinock
jerry at ieee.org
Tue Apr 19 12:39:22 PDT 2011
On 2011 Apr 18, at 12:32, Matt Calthrop wrote:
> I want to run a shell script whenever a volume is mounted – and the
> shell script needs to somehow know what the name of the volume is that
> has just been mounted.
>
> I know it can be done (HardwareGrowler does it), but I just haven't
> found out how yet.
Read:
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man5/launchd.plist.5.html
You will find:
StartOnMount <boolean>
This optional key causes the job to be started every time a filesystem is mounted.
And if that doesn't work for some reason, maybe try and "watch" /Volumes using this:
WatchPaths <array of strings>
This optional key causes the job to be started if any one of the listed paths are modified.
More information about the launchd-dev
mailing list