Basic interface to systemd
in Clojure via dbus. For now only basic service and timer functions are implemented.
(:require (...)
[clj-systemd.component :refer [new-systemd]
[clj-systemd.manager :as manager]])
(defsystem my-system
(...)
:systemd (new-systemd :instance-type :system))
(manager/get-service (:systemd system) "my-service.service")
(:require (...)
[clj-systemd.systemd :as systemd]
[clj-systemd.manager :as manager])
(let [systemd (systemd/get-systemd :system)
manager (-> (systemd/get-systemd :system)
(manager/get-manager)]
(...)
;; Clean up after, this will disconnect all :system managers
;; as `manager` is implemented as singleton in Java
(manager/disconnect :system)
get-service [manager service-name]
- Get ServiceSERVICE-NAME
get-unit [manager unit-name]
- Get UnitUNIT-NAME
get-timer [manager timer-name]
- Get TimerTIMER-NAME
start-unit - [manager unit start-mode]
- Start unitUNIT-NAME
with modeSTART-MODE
stop-unit [manager unit stop-mode]
- Stop unitUNIT-NAME
with modeSTOP-MODE
restart-unit [manager unit restart-mode]
- Restart unitUNIT-NAME
with modeRESTART-MODE
reload [manager]
- Reload systemd daemon
For more information about things like start-mode
, etc see https://www.freedesktop.org/wiki/Software/systemd/dbus/
This library is based on top of https://github.com/thjomnx/java-systemd
Copyright © 2020 Slawomir Gonet [email protected]
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.