New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

launchctl/plist/launchdaemons on snow leopard


Post Reply New Thread Subscribe

 
Thread Tools
unclepauly

 
Member Since: Nov 11, 2009
Posts: 2
unclepauly is on a distinguished road

unclepauly is offline
hello,

i have to create a daemon on a Mac OSX. the daemon must start when the Mac boots up. i have therefore wrote a daemon (using RealBasic), and also wrote a plist file which points to the daemon. everything has been running just fine on Mac OSX 10.4 for months. Now i have copied everything to Snow Leopard 10.6 and am having a small problem. let me explain what i have done so far.

1) i have created a plist file, called "myTestDaemon.plist", which lives in system/library/launchdaemons. the file is exactly this:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
	"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>myNewTestDaemon</string>
	<key>ProgramArguments</key>
	<array>
		<string>/Users/Paul/Desktop/RealBasic_Projects/My_Application</string>
	</array>
	<key>RunAtLoad</key>
	<true/>	
</dict>
</plist>
2) as the above file describes, i have put the daemon, called "myNewTestDaemon", inside /Users/Paul/Desktop/RealBasic_Projects/My_Application

3) i can then start the daemon using one of two methods - either by rebooting the Mac, in which case the launchd system tool automatically starts the daemon, or by starting the daemon manually using launchctl:

Code:
sudo launchctl load /system/library/launchdaemons/myTestDaemon.plist
once i do either of the two above methods, i can verify that the daemon is started by doing:

Code:
sudo launchctl list
and this shows that myTestDaemon.plist is indeed running.

now, i have done exactly the same thing on my shiney new Mac mini with Snow Leopard on it, but when i do the "launchctl load ...." command, it gives me an error:

Code:
"nothing found to load"
after a bit of snooping on the net i found that some people were saying that i have to add a "-F" flag to the command, so now it reads:

Code:
sudo launchctl load -F /system/library/launchdaemons/myTestDaemon.plist
apparantly, all plists have a default key called "Disabled", which, if you do not explicitly set to false, is set to true by default. setting the -F flag tells launchctl to ignore this Disabled key, which effectively makes Disable=false. so, i tried the above command with the -F flag and sure enough, this time my daemon started.

so i then explicitly added the key to my plist:

Code:
<key>Disabled</key>
<false/>
surely this should have the same affect ? apparantly not, because i still get the orginal "nothing found to load" error when i do the "launchctl load...." (without the -F flag). in addition, the daemon still does not start when the Mac boots up. and this is my problem.

like i say, this was all working in 10.4, and now not working in 10.6. So i imagine something has changed between version ? does my plist file look right ? all i need the daemon to do is start up at boot time.

hope i have explained it well. if not please ask for more info.

any help appreciated.
QUOTE Thanks
wmprice1240

 
Member Since: May 02, 2009
Posts: 480
wmprice1240 has a spectacular aura about
Mac Specs: MBP 2.33 4GB: MacPro 8 Core 2.8, 16GB: MacMini 2.26 4GB: MacMin 2.53 4GB: iPhone3GS 32GB

wmprice1240 is offline
Have a look at this:

launchctl disabled key in 10.6? - macenterprise | Google Groups

You may want to take a look at the /private/var/db/launchd.db/com.apple.launchd/overrides.plist file. Sounds like you service may have ended up there somehow. Thats the only thing I can think of. Everything else looks ok.

Also, you may want to look at the logs in the /Applications/Utilities/Console application. Typically launchctrl gives extended information in the console logs.

Oh, and welcome to the forums!
QUOTE Thanks
johnc82

 
Member Since: Dec 08, 2009
Posts: 1
johnc82 is on a distinguished road

johnc82 is offline
Hi-
I am having this same problem. Did you ever figure out how to make it work?
Thanks!
QUOTE Thanks
unclepauly

 
Member Since: Nov 11, 2009
Posts: 2
unclepauly is on a distinguished road

unclepauly is offline
Quote:
Originally Posted by johnc82 View Post
Hi-
I am having this same problem. Did you ever figure out how to make it work?
Thanks!
right - this was ages ago, and i did get to the bottom of it but i cant remember what i did exactly

heres the plist that im currently using, maybe it was extra keep-alive and disabled flags that made it work?

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
	"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>MyClientService</string>
	<key>ProgramArguments</key>
	<array>
		<string>/Users/me/Desktop/RealBasic_Projects/Test/MyClientService</string>
	</array>
	<key>KeepAlive</key>
	<true/>	
	<key>Disabled</key>
	<false/>
	<key>RunAtLoad</key>
	<true/>
</dict>
</plist>
sorry i cant be of any more help, the project has been put on hold since i posted last so its been ages since i actually played around with this - good luck
QUOTE Thanks

Post Reply New Thread Subscribe


« Mac pro hanging | Microsoft Expressions Web and Visual Basic software for Mac? »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting 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 Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Snow leopard disaster - apple is replacing my macbook pro.. EntropyX Switcher Hangout 15 10-05-2010 04:04 AM
Snow Leopard and Time Machine billwill OS X - Apps and Games 8 11-10-2009 08:46 AM
How Do I Uninstall Snow Leopard? c12susan OS X - Operating System 3 09-23-2009 10:44 PM
Snow Leopard hangs on grey screen when usb hard drive attached gilc OS X - Operating System 2 09-19-2009 06:44 PM
Leopard vs. snow leopard morganm OS X - Operating System 13 09-05-2009 09:57 AM

All times are GMT -4. The time now is 04:38 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?