5

I have a flash drive, let's name it FLASH.

I want, when on my mac, when FLASH is plugged (and automatically mounted), execute a specific script and make ~/Documents to be automatically copied to /Volumes/FLASH/Documents (mac mounts drives at /Volumes).

This same drive, FLASH, (with this new Documents folder added before with the mac situation), when plugged in an Ubuntu machine, I want it to automatically copy FLASH/Documents to ~/Documents (or automatically execute an script, after mounting).

How should I do this in these different scenarios? I don't want to use third party applications for this, I prefer using core/builtin tools available in both platforms.

0

2 Answers 2

1

Use a launchd item using the StartOnMount key!

# example launchd plist file using StartOnMount key open -e /System/Library/LaunchDaemons/com.apple.backupd-attach.plist 

Further information:

1
  • This is great @jon. Welcome to StackExchange network. :) Commented Nov 4, 2011 at 12:52
1

On the Mac, use Do Something When, a free software which triggers actions when you mount/unmount a drive.

On the Linux side, udev can run an external program when a disk is inserted (see e.g. How to be notified when a USB device was plugged in?).

1
  • I've update my question, I don't want to use third party applications. Thanks for the answer though. Commented May 13, 2011 at 22:15

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.