#349354 - 03/05/0809:02 AManyone ever set up rsync or other terminal scripts
newkojak
Mostly Proper Comma Use
Registered: 11/03/02
Posts: 3575
Loc: Chicago, IL
I have a command that I like to run in the terminal. It takes the contents of my school folder and synchronizes the changes with the same folder on a flash drive.<br><br>Is there any lightweight way that I can script the finder so that when I insert a flash drive, it automatically runs a command?<br><br>-- Cee Bee Double-U
#400330 - 12/01/0811:53 AMRe: anyone ever set up rsync or other terminal scr
[Re: Rodrigo Haenggi]
zwei
soporific
Registered: 06/26/04
Posts: 2479
Loc: Near an iPad
look into an app called "Lingon" if you want to start messing around with launchd ..it's great.
While you can do stuff via launchd when volumes are mounted ...you might want to wrap the terminal command into an applescript that looks to see what volume was mounted. Otherwise it will run when ANY volume is mounted.
This is how you would write the script...
Code:
set theVolumeName to "YourFlashDriveNameHERE"
tell application "Finder"
if disk theVolumeName exists then
do shell script "ENTER YOUR TERMINAL COMMAND HERE"
end if
end tell