Register
It is currently Mon Sep 01, 2014 3:03 pm

Run a script whenever an application opens or closes


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Sun Mar 21, 2010 2:14 pm   

Joined: Sun Mar 21, 2010 2:10 pm
Posts: 2
Hello everybody,


I suspect this is either very easy, or not possible the way I envision it.

I'm running OS X and I want to run a script that turns off Time Machine (Mac's backup utility) whenever mission-critical applications open, and then turns it back on when all of them are closed. The goal is not to make a daemon, or have to run a script to open said application, but rather make a script that knows when I open a given application and then executes. Is this possible and if so, what is its rough syntax? Thanks!


Top
 Profile  
 PostPosted: Sun Mar 21, 2010 6:51 pm   
User avatar

Joined: Sat Jun 13, 2009 8:53 pm
Posts: 73
Location: Texas!
I'm not familiar with it, but doesn't AppleScript let you do things like this? Might be worth checking out.

Why not make a script that opens the application for you (and handles the Time Machine stuff)? You could give it the normal icon and all that, I'm sure. This might result in upgrade problems though -- I have no idea how OS X handles package management.

And why not a daemon? You could use cron, which is a daemon, to check every minute to see if you are running one of the applications, and if so, call a script to do the Time Machine stuff. Despite running every minute, it's actually very low overhead. If you really need it to handle this in less than a minute after startup, you could make the script check for the application, sleep 30 seconds or so, and then try again.

- thobbs


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP