Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Delaying Automatic Startup of an App

Delaying Automatic Startup of an App
Thread Tools
Professional Poster
Join Date: Mar 2004
Location: UK
Status: Offline
Reply With Quote
Jan 11, 2012, 08:29 AM
 
Hi all,

I have an app which starts automatically via a plist file in /Library/Launchdaemons/ but I need to delay it when the Mac restarts. Other than that it needs to run full time, so I'm looking for a script or something that just kicks in before it during the startup process and delays it for a number of seconds of seconds.

Does anyone have any idea how to accomplish this?
MacBook 2.0GHz CD; MacBook Pro 15" 2.4GHz Late '08; PowerMac G4 MDD Dual 1GHz; 3x Xserve G4 1GHz; Mac Mini 2GHz; Big pile of broken and working bits;
     
Clinically Insane
Join Date: Nov 1999
Location: 888500128, C3, 2nd soft.
Status: Offline
Reply With Quote
Jan 11, 2012, 08:40 AM
 
Launching an AppleScript that includes the Wait command should do it.
     
Professional Poster
Join Date: Mar 2004
Location: UK
Status: Offline
Reply With Quote
Jan 12, 2012, 03:49 AM
 
How would that work? I still need it to auto restart if it crashes. Would using Wait and Applescript require me to meodify launchd? Would the applescript go in the lanchdaemons folder?

I've never used much Applescript. Its something I have used once or twice every few years.
MacBook 2.0GHz CD; MacBook Pro 15" 2.4GHz Late '08; PowerMac G4 MDD Dual 1GHz; 3x Xserve G4 1GHz; Mac Mini 2GHz; Big pile of broken and working bits;
     
Mac Elite
Join Date: Oct 1999
Location: Montréal, Québec (Canada)
Status: Offline
Reply With Quote
Jan 12, 2012, 04:05 PM
 
AppleScript is really easy because it uses English-like commands. Open AppleScript Editor in Application/Utilities then paste the following command:

Code:
delay 5 tell application "Terminal" to launch
(replace Terminal by the real name and change the number of seconds to the desired amount)

then save as an Application, then point your daemon to this script instead of your original app. Voilà

If you want to test it before, press Compile, this will catch any error, then press Run. If everything works as planned, save your script in the launch folder as an application and you're good to go!
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:57 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2