Peter Abrahamsen | 24 Apr 00:47 2009
Picon

Launchd plists, anyone?

Hi folks,

I've found myself crafting some launchd plists for some daemons we use
here, such as postgresql. Are these things that other people are
interested in? I could file a bug with a copy of the plist file (to be
installed into usr/share) and a patch to the ebuild to issue install
instructions where appropriate, if this would be useful to other
folks.

Cheers,
Peter

Dirk Tilger | 28 Apr 08:58 2009
Picon

Re: Launchd plists, anyone?

On 2009-04-23, Peter Abrahamsen <rainhead <at> gmail.com> wrote:
> I've found myself crafting some launchd plists for some daemons we use
> here, such as postgresql. Are these things that other people are
> interested in? I could file a bug with a copy of the plist file (to be
> installed into usr/share) and a patch to the ebuild to issue install
> instructions where appropriate, if this would be useful to other
> folks.

Yes, me. ;)

But actually, I had a different approach in mind (I believe). One of the
things that drove me to Gentoo was how the runlevel scripts dealt with
dependencies. 

I have been using a custom baselayout-prefix ebuild for a while (1.5a)
that actually allows me to start services just like on a normal Gentoo.
The only drawback is that the runlevel management does not notice
reboots and thus does not notice when running daemons just went missing.

My idea was to have a single LaunchAgent plist and that would be
starting the runlevel management of the prefixed Gentoo just about the
same way "init" is doing it for normal Gentoo when you log in. 

Then one can add service scripts using rc-update or whatever way one
would use on a normal Gentoo. We would need something for the shutdown,
too, and here I haven't got any good ideas yet.

Maybe we can work together one this?

Dirk.
(Continue reading)

Alexander Kellett | 28 Apr 14:36 2009
Picon

Re: Re: Launchd plists, anyone?

sorry for the lame contentless reply... hope positive feedback is welcome.

i like this idea specifically a lot, and in general the addition of
start scripts (currently i'm just starting mysqld on the command line
each time i reset my mac, which is quite frustrating).

launchd is very blackboxish to me, while i know gentoo start up
scripts well. maybe a hybrid approach could be found without too much
code dup that is ideal for either?

On Tue, Apr 28, 2009 at 8:58 AM, Dirk Tilger <dirk <at> miriup.de> wrote:
> On 2009-04-23, Peter Abrahamsen <rainhead <at> gmail.com> wrote:
>> I've found myself crafting some launchd plists for some daemons we use
>> here, such as postgresql. Are these things that other people are
>> interested in? I could file a bug with a copy of the plist file (to be
>> installed into usr/share) and a patch to the ebuild to issue install
>> instructions where appropriate, if this would be useful to other
>> folks.
>
> Yes, me. ;)
>
> But actually, I had a different approach in mind (I believe). One of the
> things that drove me to Gentoo was how the runlevel scripts dealt with
> dependencies.
>
> I have been using a custom baselayout-prefix ebuild for a while (1.5a)
> that actually allows me to start services just like on a normal Gentoo.
> The only drawback is that the runlevel management does not notice
> reboots and thus does not notice when running daemons just went missing.
>
(Continue reading)

zAfi | 28 Apr 15:03 2009
Picon

Re: Re: Launchd plists, anyone?

Well, I like the idea as well, especially what Dirk suggested as this
would fit very well in the whole prefix approach and wouldn't require
that much patches imho. ;)

For your mysqld autostartup, simply create a com.mysql.mysqld.plist
file at /Library/LaunchDaemons with the following content (change to
your needs):
<?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>GroupName</key>
    <string>mysql</string>
    <key>KeepAlive</key>
    <true/>
    <key>Label</key>
    <string>com.mysql.mysqld</string>
    <key>Program</key>
    <string>/Users/*/Gentoo/usr/bin/mysqld_safe</string>
    <key>UserName</key>
    <string>*USERNAME_here_under_which_the_process_should_run*</string>
</dict>
</plist>

chmod 644 and chown root:wheel
Kudos to macports...

Another way would be to drop mysqld_safe into your autostart objects
in your system preferences...
(Continue reading)

Peter Abrahamsen | 1 May 01:11 2009
Picon

Re: Re: Launchd plists, anyone?

Hi all,

Well you're certainly right, Dirk, that one launchd plist for all of
Gentoo would be easier than distributing a plist per daemon and
worrying about where to put it. We'd lose some of the functionality of
launchd, but it's probably a win for non-Darwin prefix users if we
work on maintaining init.d scripts.

Is the problem with the runlevel not getting reset to do with your
launchagent being fire-and-forget, with no reboot-time hook?

Perhaps we could write a small application to stay resident and
respond to launchd, shutting daemons down cleanly on reboot.

Peter

On Tue, Apr 28, 2009 at 6:03 AM, zAfi <nietonfir <at> gmail.com> wrote:
> Well, I like the idea as well, especially what Dirk suggested as this
> would fit very well in the whole prefix approach and wouldn't require
> that much patches imho. ;)
>
> For your mysqld autostartup, simply create a com.mysql.mysqld.plist
> file at /Library/LaunchDaemons with the following content (change to
> your needs):
> <?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>GroupName</key>
(Continue reading)

Dirk Tilger | 3 May 21:34 2009
Picon

Re: Launchd plists, anyone?

On 2009-04-28, Alexander Kellett <a <at> lypanov.net> wrote:
> sorry for the lame contentless reply... hope positive feedback is welcome.
>
> i like this idea specifically a lot, and in general the addition of
> start scripts (currently i'm just starting mysqld on the command line
> each time i reset my mac, which is quite frustrating).

For anyone interested: I merged my baselayout-prefix changes with the
latest baselayout-prefix ebuild.

https://bugs.gentoo.org/show_bug.cgi?id=196294 

Who enjoys playing with water and electricity as much as I do, applies
this patch to the ebuild:

https://bugs.gentoo.org/attachment.cgi?id=190244

Then, copy all these files into the "files" directory of the package:

- https://bugs.gentoo.org/attachment.cgi?id=133767 as
  baselayout-1.12.5-sh.patch
- https://bugs.gentoo.org/attachment.cgi?id=133768 as
  baselayout-1.12.5-src.patch
- https://bugs.gentoo.org/attachment.cgi?id=133772 as
  baselayout-1.12.5-no-consoletype.patch
- https://bugs.gentoo.org/attachment.cgi?id=190245 as
  baselayout-1.12.5-pidof.patch

Now you run `ebuild $EBUILD manifest merge` with $EBUILD pointing to the file
you patched earlier. Then you should have the same baselayout as I do.
(Continue reading)

Armando Di Cianno | 4 May 16:48 2009
Picon

Re: Launchd plists, anyone?

I have an eselect launchdagents addition, already released last year,
that ties launchd items into a user's start-up profile.  Since
beginning to run prefix privileged, I've started to add support for
system-level start-up as well.  (I also had a need for a managed
postgresql start-up script last year.)

Dirk mentioned the desire to have one "meta" launchd script, but
frankly, and I'm not sure I agree with this.  It's certainly possible,
but one plist per-daemon is practically requisite on OSX given all the
configuration you can do in the plist.  There's also a lot of Linux
and path specific stuff in most of the init.d/conf.d scripts.
Definitely worth discussing more.

My tree is pretty antiquated (I really at least need to clean out a
lot of the stuff that made it into the tree), but you can find the
package there -- or simply go here:
  http://dicianno.org/svn/PrefixPortage/branches/overlay-fafhrd/app-admin/eselect-launchdagents/

__armando

On Thu, Apr 23, 2009 at 6:47 PM, Peter Abrahamsen <rainhead <at> gmail.com> wrote:
> Hi folks,
>
> I've found myself crafting some launchd plists for some daemons we use
> here, such as postgresql. Are these things that other people are
> interested in? I could file a bug with a copy of the plist file (to be
> installed into usr/share) and a patch to the ebuild to issue install
> instructions where appropriate, if this would be useful to other
> folks.
>
(Continue reading)


Gmane