systemd / pystemd

A thin Cython-based wrapper on top of libsystemd, focused on exposing the dbus API via sd-bus in an automated and easy to consume way.
GNU Lesser General Public License v2.1
409 stars 36 forks source link

How to enable/disable units? #62

Open farzadpanahi opened 2 years ago

farzadpanahi commented 2 years ago

I cannot find any example on how to enable/disable units. Can someone elaborate on how this can be done using this lib? I can see there is a function called EnableUnitFiles but I am not sure how it should be used!

alfonsoIST commented 1 year ago

Try this:

from pystemd.systemd1 import Manager
with Manager() as manager:
    manager.Manager.EnableUnitFiles([b'/etc/systemd/system/service_name.service'], True, True)
AndySchroder commented 2 weeks ago

What are the True values for?