[arch-general] My end-user $0.02 on /etc/rc.conf splitting.

C Anthony Risinger anthony at xtfx.me
Wed Jul 25 06:17:13 EDT 2012


On Wed, Jul 25, 2012 at 3:44 AM, Nicolas Sebrecht <nsebrecht at piing.fr> wrote:
> The 25/07/12, Heiko Baums wrote:
>>
>> systemd I have to run a special command to have a daemon started at
>> boot time (which I additionally have to remember), I have to write such
>> an ini file instead of just writing or editing a simple and small
>> config file or shell script
>
> You are mixing up two things:
> - adding/removing services on boot;
> - configuring the services.
>
> The first - adding/removing services - changes with systemd. Yes, it is
> done using a dedicated command (which comes naturally with
> autocompletion, here with zsh at least). This is for services provided
> by the distribution.
>
> If a service is not provided:
> - with SysVinit you have to write the whole script usually relying on
>   whatever library the distribution provides (which tend to be
>   error-prone);
> - with systemd, you just write a configuration file.
>
> For the second, whether you use systemd or SysVinit, configuring a
> service is typically done by editing the configuration file dedicated to
> this service.  In systemd, the file is declared like this
>
>   EnvironmentFile=/etc/conf.d/nfs
>
> which is by itself much easier to hack (rather than reading in a shell
> script to find where and how such a file is used).

... and to elaborate on this, writing a unit file is not the end of
the world. in fact, it's so !@%$ing painless that i literally bang one
out in ~2 minutes flat (not an exaggeration).

100% TANGIBLE, CONCRETE, NON-HYPOTHETICAL example ... i wrote this in
a ~2 minute period sometime between the now and my last message ooooh,
45 min ago:

# cat /usr/lib/systemd/system/u.openvpn.service
=====================================
[Unit]
Description=[u] OpenVPN server
After=network.target

[Service]
Type=simple
TimeoutSec=0
Restart=always
RestartSec=30
ExecStart=/usr/sbin/openvpn --config /etc/openvpn/u.openvpn.conf
ExecStartPost=/usr/sbin/ip link set vpn0 up promisc on master lan0
ExecReload=/bin/kill -SIGUSR1 $MAINPID

[Install]
WantedBy=u.services.target
=====================================

... aaaand done. works bomb. linked to my custom target. automatic
reloads. dynamic TAP device. automatic adding of TAP dev to existing
bridge. works bomb? :-)

"but anthony! what did it REALLY take?", one likely inquires ... well
i'm glad you asked!

procedure:
 - copy one of my other daemon unit files
 - change ~3 lines
 - declare masterpiece

... there is no way to convince me or anyone else that process is
somehow *more* complex than editing/managing the ~83-line combined
`openvpn` and `openvpn-tapdev` rc.d scripts ...

ehm ... hi.

i have zilch against sysvinit, initscripts, or anything else for that
matter -- to have a persuasion for-or-against a piece of software on
anything but technical merits is rather silly IMO, even your own --
but to put it bluntly, systemd is, hands-down, superior, and a win in
all ways over the long standing sysvinit ... just let it be so
friends.

-- 

C Anthony


More information about the arch-general mailing list