|
|
Subscribe / Log in / New account

LCE: Systemd two years on

LCE: Systemd two years on

Posted Nov 9, 2012 1:22 UTC (Fri) by marcH (subscriber, #57642)
In reply to: LCE: Systemd two years on by mpr22
Parent article: LCE: Systemd two years on

I don't think it's possible to modify C code using a shell script language.


to post comments

LCE: Systemd two years on

Posted Nov 9, 2012 7:50 UTC (Fri) by smitty_one_each (subscriber, #28989) [Link]

Bash isn't written in C, and you couldn't (for example, I haven't checked this) pull Bash's parser into another program, so that a legacy script could remain usable?

LCE: Systemd two years on

Posted Nov 9, 2012 19:00 UTC (Fri) by speedster1 (guest, #8143) [Link]

Having used systemd on an embedded project by now, I can say from experience that legacy init scripts can just as easily be called via a systemd config file aka "unit file" as they could via the base rc script. I don't remember having to modify the base rc script which iterates through all the scripts in the appropriate runlevel, and analogously I do not expect to have to modify the systemd parser which iterates through unit files to decide what services need to be kicked off.

sysvinit -> inittab -> rc script -> init.d scripts

systemd -> unit files -> init.d scripts

There is an option to stick the start/stop command lines directly in the unit files if they are single-liners, but if that is the case the main thing an admin might want to do is stick in a 'strace' or 'ltrace' of the daemon, and that can just as easily be done by editing the unit file as an init.d script.

The increasing list of dependencies for normal systemd operation on the other hand... can indeed be a pain for embedded projects. Even the requirement for cgroup support required a patch against the vendor-supplied kernel (yes many embedded Linux projects are *still* that out of date)

LCE: Systemd two years on

Posted Nov 15, 2012 9:09 UTC (Thu) by HelloWorld (guest, #56129) [Link] (1 responses)

What kind of argument is that supposed to be? You don't need to modify systemd's C code to launch a shell script from a systemd unit. Just stick the script's name in the unit file's ExecStart line.

LCE: Systemd two years on

Posted Nov 15, 2012 15:21 UTC (Thu) by marcH (subscriber, #57642) [Link]

> What kind of argument is that supposed to be?

The poster right above yours seems to have understood it.

LCE: Systemd two years on

Posted Nov 15, 2012 12:31 UTC (Thu) by Wol (subscriber, #4433) [Link] (1 responses)

aiui, any *properly* *written* init script is 99% boilerplate, and 1% specific. Assuming just ten lines of specific code, that's a thousand lines of boilerplate :-)

systemd simply implements that 99% in small C procedures. The result is far less duplicate code, and far less opportunity for mistakes. Plus far greater testing, and hence solidity.

That one percent is still a text-editable script, just a systemd config file rather than bash code.

Cheers,
Wol

LCE: Systemd two years on

Posted Nov 15, 2012 14:30 UTC (Thu) by Eckhart (guest, #74500) [Link]

> aiui, any *properly* *written* init script is 99% boilerplate, and 1% specific.

Properly written init scripts are a rare thing to begin with. Just as an example, the behaviour of Debian init scripts wrt to "force-reload" is completely random: about half of the init scripts start non-running services on force-reload, the other half of them don't.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds