From: "Canek Peláez Valdés" <caneko@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Re: systemd? [ Was: The End Is Near ... ]
Date: Sat, 17 Mar 2012 20:30:25 -0600 [thread overview]
Message-ID: <CADPrc83pDqa=89uBkQMf5TFbgv2j=p-p9aik-QGeG-x2VA+eQg@mail.gmail.com> (raw)
In-Reply-To: <CAA2qdGUf8JDopUoFjs_zce2xHh0PDy36Qfdzr1kXTJ=GmoEbGA@mail.gmail.com>
On Sat, Mar 17, 2012 at 8:20 PM, Pandu Poluan <pandu@poluan.info> wrote:
>
> On Mar 18, 2012 8:48 AM, "Canek Peláez Valdés" <caneko@gmail.com> wrote:
>>
>> On Sat, Mar 17, 2012 at 6:48 PM, Nikos Chantziaras <realnc@gmail.com>
>> wrote:
>> > On 17/03/12 13:53, Alan Mackenzie wrote:
>> >>
>> >> Hello, Nikos.
>> >>
>> >> On Sat, Mar 17, 2012 at 08:25:48AM +0200, Nikos Chantziaras wrote:
>> >>
>> >>>> Happy Computer Users, systemd is on your horizon.
>> >>
>> >>
>> >>> No, we don't. I hope systemd arrives soon. It's the best init system
>> >>> I
>> >>> ever saw.
>> >>
>> >>
>> >> What's so good about it? What will it do for me?
>> >>
>> >> I have this horrible sneaking suspicion that it will be more
>> >> complicated
>> >> than /sbin/init + OpenRC, just like udev + initramfs is more
>> >> complicated
>> >> than udev, and CUPS is more complicated than classical lpr.
>> >>
>> >> Why do you find it so good?
>> >
>> >
>> > No idea. I only posted this because the OP didn't say what's bad about
>> > systemd :-) I really don't know I should care whether my system runs
>> > OpenRC
>> > or systemd.
>>
>> Take this with a grain (or a kilo) of salt, since I'm obviously
>> biased, but IMHO this are systemd advantages over OpenRC:
>>
>> * Really fast boot. OpenRC takes at least double the time that systemd
>> does when booting, easily verifiable. In my laptop systemd is twice as
>> fast as OpenRC; in my desktop is three times faster.
>>
>> * Really parallel service startup: OpenRC has never been reliable on
>> parallel service startup; its documentation says it explicitly.
>>
>> * Really simple service unit files: The service unit files are really
>> small, really simple, really easy to understand/modify. Compare the 9
>> lines of sshd.service:
>>
>> $ cat /etc/systemd/system/sshd.service
>> [Unit]
>> Description=SSH Secure Shell Service
>> After=syslog.target
>>
>> [Service]
>> ExecStart=/usr/sbin/sshd -D
>>
>> [Install]
>> WantedBy=multi-user.target
>>
>> with the 84 of /etc/init.d/sshd (80 without comments).
>>
>> * Really good documentation: systemd has one of the best
>> documentations I have ever seen in *any* project. Everything (except
>> really new, experimental features) is documented, with manual pages
>> explaining everything. And besides, there are blog posts by Lennart
>> explaining in a more informal way how to do neat tricks with systemd.
>>
>> * Really good in-site customization: The service unit files are
>> trivially overrided with custom ones for specific installations,
>> without needing to touch the ones installed by systemd or a program.
>> With OpenRC, if I modify a /etc/init.d file, chances are I need to
>> check out my next installation so I can see how the new file differs
>> from the old one, and adapt the changes to my customized version.
>>
>> * All the goodies from Control Groups: You can use kernel cgroups to
>> monitor/control several properties of your daemons, out of the box,
>> almost no admin effort involved.
>>
>> * It tries to unify Linux behaviour among distros (some can argue that
>> this is a bad thing): Using systemd, the same
>> configurations/techniques work the same in every distribution. No more
>> need to learn /etc/conf.d, /etc/sysconfig, /etc/default hacks by
>> different distros.
>>
>> * Finally, and what I think is the most fundamental difference between
>> systemd and almost any other init system: The service unit files in
>> systemd are *declarative*; you tell the daemon *what* to do, not *how*
>> to do it. If the service files are shell scripts (like in
>> OpenRC/SysV), everything can spiral out of control really easily. And
>> it usually does (again, look at sshd; and that one is actully nicely
>> written, there are all kind of monsters out there abusing the power
>> that shell gives you).
>>
>> These are the ones off the top of my head; but what I like the most
>> about systemd is that it just works, and that it makes a lot of sense
>> (at least to me).
>>
>> Most of systemd features can be implemented in OpenRC (although the
>> speed difference will never be eliminated if OpenRC keeps using shell
>> files). My question is: why bother? systemd is already here, it
>> already works, and it's actually supported in Gentoo.
>>
>> But again, remember that I'm biased: I keep an overlay to run Gentoo
>> systems with only systemd; no OpenRC, no baselayout, no SysV. You guys
>> can try it if you want:
>>
>> http://xochitl.matem.unam.mx/~canek/gentoo-systemd-only/
>>
>> Usual disclaimer: I take no responsibility if using my overlay results
>> in your systems asploding. That said, I'm using it on all my machines
>> without a hitch.
>>
>> Regards.
>
> Interesting...
>
> However, what if the service is complex? For example, I created a "gatewall"
> service which, upon boot, initializes :
>
> * Routing tables and the RPDB
> * ipset
> * iptables
>
> while ensuring that upon shutdown, the settings of the above are
> (optionally) saved.
>
> How do I specify such intelligence?
Well, first of all you have options for starting a service, but also
for stopping it. But besides that, please understand that while
systemd does not use shell files *itself*, it doesn't stop you from
using them if you so desire. In other words, put the "intelligence" on
a script:
/usr/local/bin/my-really-smart-and-complex-script.sh
With proper execution settings (i.e., chmod 755 and with "#!/bin/sh"
shebang), and then add a service file that exec's that:
# cat /etc/systemd/system/mycomplexscript.service
[Unit]
Description=My complex script
After=basic.target
[Service]
ExecStart=/usr/local/bin/my-really-smart-and-complex-script.sh
Then you only run:
# systemctl daemon-reload
And you start your script with:
# systemctl start mycomplexscript.service
If you want to enable it by default, add a link to it in
/etc/systemd/system/multi-user.target.wants, or add an install
section:
[Install]
WantedBy=multi-user.target
And enable it with systemctl (after daemon-reload again):
# systemctl enable mycomplexscript.service
systemd doesn't stop you from using scripts. But, if the service is
properly designed, it shouldn't be necessary. For example, you could
probably break your complex script in small service unit files, and
make them depend among each other, so the correct startup sequence is
achieved.
Check the docs, it's really amazing.
Regards.
--
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México
next prev parent reply other threads:[~2012-03-18 2:31 UTC|newest]
Thread overview: 110+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-17 4:11 [gentoo-user] The End Is Near ... or, get the vaseline, they're on the way! Bruce Hill, Jr.
2012-03-17 4:19 ` Canek Peláez Valdés
2012-03-17 4:37 ` Bruce Hill, Jr.
2012-03-17 4:53 ` Canek Peláez Valdés
2012-03-17 5:19 ` Pandu Poluan
2012-03-17 6:25 ` [gentoo-user] " Nikos Chantziaras
2012-03-17 11:53 ` [gentoo-user] systemd? [ Was: The End Is Near ... ] Alan Mackenzie
2012-03-18 0:48 ` [gentoo-user] " Nikos Chantziaras
2012-03-18 1:45 ` Canek Peláez Valdés
2012-03-18 2:12 ` Nikos Chantziaras
2012-03-18 2:41 ` Joshua Murphy
2012-03-18 2:52 ` Pandu Poluan
2012-03-18 2:20 ` Pandu Poluan
2012-03-18 2:30 ` Canek Peláez Valdés [this message]
2012-03-18 3:02 ` Bruce Hill, Jr.
2012-03-18 3:27 ` Canek Peláez Valdés
2012-03-18 8:02 ` Graham Murray
2012-03-18 8:49 ` Canek Peláez Valdés
2012-03-18 11:23 ` Pandu Poluan
2012-03-18 19:25 ` Canek Peláez Valdés
2012-03-18 19:48 ` Michael Mol
2012-03-18 19:54 ` Alan McKinnon
2012-03-18 19:59 ` Frank Steinmetzger
2012-03-19 13:33 ` Neil Bothwick
2012-03-19 13:57 ` Michael Mol
2012-03-18 13:15 ` Alan McKinnon
2012-03-18 13:56 ` Dale
2012-03-18 22:23 ` Walter Dnes
2012-03-18 22:35 ` Alan McKinnon
2012-03-19 22:58 ` Walter Dnes
2012-03-19 23:18 ` Alan McKinnon
2012-03-21 4:40 ` Walter Dnes
2012-03-21 14:29 ` Alan McKinnon
2012-03-21 16:02 ` Michael Mol
2012-03-21 22:55 ` Walter Dnes
2012-03-22 1:35 ` Michael Mol
2012-03-22 21:13 ` Walter Dnes
2012-03-22 22:07 ` Mike Edenfield
2012-03-23 1:27 ` Michael Mol
2012-03-29 6:52 ` J. Roeleveld
2012-03-19 13:30 ` Neil Bothwick
2012-03-18 2:48 ` Bruce Hill, Jr.
2012-03-18 2:57 ` Canek Peláez Valdés
2012-03-18 4:17 ` Bruce Hill, Jr.
2012-03-18 7:28 ` Canek Peláez Valdés
2012-03-19 13:20 ` Eliezer Croitoru
2012-03-19 13:49 ` Alex Schuster
2012-03-19 13:13 ` Neil Bothwick
2012-03-19 14:33 ` Bruce Hill, Jr.
2012-03-19 23:11 ` Neil Bothwick
2012-03-17 8:00 ` [gentoo-user] The End Is Near ... or, get the vaseline, they're on the way! Andrea Conti
2012-03-17 12:03 ` Bruce Hill, Jr.
2012-03-19 13:17 ` Neil Bothwick
2012-03-19 13:27 ` Mark Knecht
2012-03-19 23:04 ` Alan McKinnon
2012-03-19 23:33 ` Neil Bothwick
2012-03-19 23:49 ` Alan McKinnon
2012-03-20 1:13 ` wdk@moriah
2012-03-20 8:41 ` Neil Bothwick
2012-03-17 11:59 ` Alan Mackenzie
2012-03-17 12:05 ` Bruce Hill, Jr.
2012-03-17 12:50 ` Tanstaafl
2012-03-17 12:54 ` Eliezer Croitoru
2012-03-17 14:03 ` Peter Humphrey
2012-03-18 9:52 ` Dale
2012-03-18 18:01 ` Eliezer Croitoru
2012-03-18 20:39 ` Dale
2012-03-18 22:28 ` Alan McKinnon
2012-03-19 0:30 ` Canek Peláez Valdés
2012-03-19 2:03 ` William Kenworthy
2012-03-19 13:40 ` Eliezer Croitoru
2012-03-19 13:56 ` Alex Schuster
2012-03-29 9:35 ` [gentoo-user] chicken/eff issue with suspend-to-disk/hibernate problem [Was: The End Is Near ... or, get the vaseline, they're on the way!] J. Roeleveld
2012-03-29 10:40 ` wdk@moriah
2012-03-29 13:51 ` J. Roeleveld
2012-03-29 14:04 ` Neil Bothwick
2012-03-29 23:05 ` wdk@moriah
2012-03-18 17:30 ` [gentoo-user] The End Is Near ... or, get the vaseline, they're on the way! Tanstaafl
2012-03-17 14:08 ` Jarry
2012-03-19 13:25 ` Neil Bothwick
2012-03-17 15:10 ` Mark Knecht
2012-03-17 17:36 ` Canek Peláez Valdés
2012-03-17 17:58 ` Mark Knecht
2012-03-17 18:38 ` Volker Armin Hemmann
2012-03-17 19:40 ` pk
2012-03-17 20:09 ` Volker Armin Hemmann
2012-03-17 20:28 ` pk
2012-03-18 9:51 ` Dale
2012-03-18 13:03 ` Alan McKinnon
2012-03-18 13:52 ` Dale
2012-03-19 13:22 ` Neil Bothwick
2012-03-18 11:44 ` [gentoo-user] " walt
2012-03-17 20:15 ` [gentoo-user] " Alan McKinnon
2012-03-18 0:43 ` Mark Knecht
2012-03-18 2:18 ` William Kenworthy
2012-03-18 3:57 ` Bruce Hill, Jr.
2012-03-18 6:30 ` Michael Mol
2012-03-18 7:26 ` Bruce Hill, Jr.
2012-03-18 7:54 ` Michael Mol
2012-03-18 12:01 ` Bruce Hill, Jr.
2012-03-18 12:47 ` Volker Armin Hemmann
2012-03-18 13:23 ` Bruce Hill, Jr.
2012-03-18 14:08 ` Volker Armin Hemmann
2012-03-18 13:29 ` Mark Knecht
2012-03-18 17:38 ` Tanstaafl
2012-03-29 9:48 ` J. Roeleveld
2012-03-18 13:27 ` Mark Knecht
2012-03-17 23:02 ` [gentoo-user] " »Q«
2012-03-18 8:16 ` [gentoo-user] " Walter Dnes
2012-03-19 9:48 ` Helmut Jarausch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADPrc83pDqa=89uBkQMf5TFbgv2j=p-p9aik-QGeG-x2VA+eQg@mail.gmail.com' \
--to=caneko@gmail.com \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox