Opened 11 years ago

Closed 7 years ago

#22570 closed enhancement (fixed)

startupitems - RunAtLoad setting

Reported by: dreamcat4@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: base Version: 1.8.1
Keywords: Cc:
Port:

Description

It seems that we could easily template - out some flexibility in the launchd startupitems. Ideally, to allow users to run a command which affects the "RunAtLoad" plist key.

OnDemand key is also worthwhile to template.

<key>OnDemand</key><false/> <key>RunAtLoad</key><false/>

Similar tickets #18174 and #22471

Attachments (1)

portstartupitem.tcl-rrdtool.diff (537 bytes) - added by dreamcat4@… 11 years ago.
Improve startupitems default template

Download all attachments as: .zip

Change History (7)

comment:1 Changed 11 years ago by dreamcat4@…

BUT RunAtLoad generally doesn't play nicely with Daemondo.

It's all to do with forking and listen ports. Launchd can't hand over the TCP port / sockets its listening in on to anything other than the process it launched. So uh-oh! Running daemondo will *not* work. Period. Launchd must perform certain process - port - handover to the newly launched process, and daemondo doesn't know anything about TCP port / unix socket to hand over. Just running the command directly will solve such problem entirely.

So to use effectively by a startupitem template we need an alternate non-daemondo template. Currently all startupitems templates use daemondo. This would have to change for allowing some bare command running in the generated plist file.

comment:2 Changed 11 years ago by jmroot (Joshua Root)

Summary: startupitems - No RunAtLoad setting ?startupitems - RunAtLoad setting
Type: defectenhancement

comment:3 Changed 11 years ago by dreamcat4@…

BUT RunAtLoad generally doesn't play nicely with Daemondo.

Sorry I meant to say "OnDemand" and not RunAtLoad.

comment:4 Changed 11 years ago by dreamcat4@…

In 10.6 you can programmatically manipulate the overrides.plist. Although there is no sanctioned command to do so.

/var/db/launchd.db/com.apple.launchd/overrides.plist

It would be possible to write an api command to insert / modify the relevant xml fragment. For example

	<key>org.macports.nginx</key>
	<dict>
		<key>Disabled</key>
		<false/>
	</dict>
	<key>org.macports.rabbitmq-server</key>
	<dict>
		<key>Disabled</key>
		<false/>
		<key>RunAtLoad</key>
		<true/>
	</dict>
	<key>org.macports.rb-chef-indexer</key>
	<dict>
		<key>Disabled</key>
		<false/>
	</dict>
	<key>org.macports.rb-chef-server</key>
	<dict>
		<key>Disabled</key>
		<true/>
	</dict>

Changed 11 years ago by dreamcat4@…

Improve startupitems default template

comment:5 Changed 11 years ago by dreamcat4@…

Okay, I've attached some sensible defaults for:

browser:trunk/base/src/port1.0/portstartupitem.tcl

The OnDemand key itself is now deprecated and defaults to false anyway. Use Sockets / WatchPaths / QueueDirectories keys for setting OnDemand status. That's a more complex area. Until then please use the patch. This patch will make the "port load" command persistent across reboots. Update base and re-install ports to take effect.

Last edited 7 years ago by ryandesign (Ryan Schmidt) (previous) (diff)

comment:6 Changed 7 years ago by neverpanic (Clemens Lang)

Resolution: fixed
Status: newclosed

I think this is fixed because we use <key>KeepAlive</key><true/> on systems > 10.4 now.

Note: See TracTickets for help on using tickets.