I want to make a script that automatically backs up my kindle files when I connect it to my macbook pro. Writing the script is well within my ability, but I don't know what's the best way to run a script on mount automatically.
You could either use AppleScript and attach a folder action to the /Volumes
directory, or you could write a Launch Agent that watches that path.
For the latter, you can refer to Tutorial: Backups with Launchd on MacResearch. The gist of it is that you create a plist configuration file to be interpreted by launchd
; then launchd
will execute your script when the specified path has changed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With