pystemd icon indicating copy to clipboard operation
pystemd copied to clipboard

How to enable/disable units?

Open farzadpanahi opened this issue 3 years ago • 2 comments

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!

farzadpanahi avatar Nov 25 '21 23:11 farzadpanahi

Try this:

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

alfonsoIST avatar Feb 21 '23 18:02 alfonsoIST

What are the True values for?

AndySchroder avatar Jun 27 '24 19:06 AndySchroder