Thursday, November 27, 2008

OSX Automator, USB Drive Insertion or Mounted Volumes & Backup

I was looking for a way to trigger an event when a volume is mounted on my system when I came accross this auto detect mounted volumes post. I'm completely new to automator, so all I want it to do is kick off a shell script.

Now the shell script runs whenever any volume is mounted. But what happens to stdout & stderr when the script is triggered by automator? Well - it vanishes, so you need to redirect it somewhere useful. Early on in my script I redirect stdout and stderr to a log file:

exec > ~/Library/Logs/mount-event.out 2>&1


The script will not receive any incoming content or variables and the current working directory will be they users' home, so you just need to start from scratch.

No comments: