Re: Several Questions
Re: Several Questions
- Subject: Re: Several Questions
- From: Todd Heberlein <email@hidden>
- Date: Mon, 01 Jun 2009 17:51:48 -0700
Great, so I understand from what you're saying that I can launch a
GUI app
using launchd?
Out of curiosity, I just tried this. I created a basic Cocoa app (I
made no changes to it, I just built the default skeleton application
that Xcode creates for you). The project is in the directory:
/Users/heberlei/Development/Tests/BasicApp/
and the full path to the program is
/Users/heberlei/Development/Tests/BasicApp/build/Debug/Basic.app/
Contents/MacOS/BasicApp
I then created a launchd XML file called app_shouldnt_die.plist and
put it in the directory
/Library/LaunchAgents
(I also set it to be owned by root:wheel, don't know if that matters).
Now when I log in, that BasicApp starts up. If I quit the app, it
starts again (usually within ~5 seconds). If I do the "kill <pid>"
command from the command line, the application starts again.
Also, when I login as a completely different user, the application
still starts up automatically. So no matter who logs in, they have to
live with this darn app alway on. Pretty cool (or maybe just
irritating :).
The content of app_shouldnt_die.plist that directs launchd to always
keep the program running is:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd
">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.netsq.app_shouldnt_die</string>
<key>Program</key>
<string>/Users/heberlei/Development/Tests/BasicApp/build/Debug/
BasicApp.app/Contents/MacOS/BasicApp</string>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
Todd
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden