[systemd-devel] Can LSBInitScipts specify an dependency on systemd unit?

Reindl Harald h.reindl at thelounge.net
Thu Jun 9 10:06:42 UTC 2016



Am 09.06.2016 um 12:02 schrieb Andrei Borzenkov:
> On Thu, Jun 9, 2016 at 1:00 PM, Jóhann B. Guðmundsson
> <johannbg at gmail.com> wrote:
>> On 06/09/2016 09:02 AM, Ross Lagerwall wrote:
>>
>>> On Thu, Jun 9, 2016 at 9:55 AM, Bao Nguyen <baondt at gmail.com> wrote:
>>> With a new enough systemd, you should be able to add a snippet to extend
>>> the initscript like this:
>>> $ cat /etc/systemd/system/my_lsb_service.service.d/local.conf
>>> [Unit]
>>> Requires=systemd_1.service
>>> After=systemd_1.service
>>
>>
>> That's just silly and introduces another level of administrator headache.
>>
>
> It is not silly if you have third-party software that comes with
> initscript and need to fix dependencies of this script locally. You
> have no control of script itself in this case.

surely - a systemd-unit in /etc/systemd/system/ takes precedence

[root at srv-rhsoft:~]$ ls /etc/init.d/vmware
-rwxr-xr-x 1 root root 14K 2016-04-24 21:34 /etc/init.d/vmware

[root at srv-rhsoft:~]$ ls /etc/systemd/system/vmware.service
-rw-r--r-- 1 root root 465 2015-09-01 17:02 
/etc/systemd/system/vmware.service

guess who wins

[root at srv-rhsoft:~]$ systemctl status vmware
vmware.service - VMware Workstation Service
    Loaded: loaded (/etc/systemd/system/vmware.service; enabled; vendor 
preset: disabled)
    Active: active (exited) since Do 2016-06-09 01:29:04 CEST; 10h ago
   Process: 1135 ExecStart=/usr/bin/systemctl start vmware.target 
(code=exited, status=0/SUCCESS)
  Main PID: 1135 (code=exited, status=0/SUCCESS)
    CGroup: /system.slice/vmware.service

> But yes, if you are able to modify initscript it is really easier to
> just add proper unit defnition

you don't need to touch it - just override it with a systemd-unit which 
in doubt does nothing else then call the /etc/init.d/script in ExecStart 
and ExecStop


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20160609/bd4e26d7/attachment.sig>


More information about the systemd-devel mailing list