I would like to implement the systemd functionality from python script. Start and stop the services in Linux machine from python script using third party library.
e.g: sudo systemctl start application.service
I know there is a library which support the systemd kind of functionality, i.e DBUS
import dbus
sysbus = dbus.SystemBus()
But, I am looking for an best library other than dbus. Any ideas...
yes there is pystemd
https://github.com/facebookincubator/pystemd
the tl;dr; ussage is
with Unit(b'postfix.service') as service:
service.Unit.Start('replace')
also provides nice interface to pystemd.run
and sd_notify
readme and _docs folder have a lot of code examples... feel free to ask anithing