Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
activation/ | H | 04-Nov-2019 | - | |||
daemon/ | H | 04-Nov-2019 | - | |||
dbus/ | H | 04-Nov-2019 | - | |||
examples/activation/ | H | 04-Nov-2019 | - | |||
fixtures/ | H | 03-May-2022 | - | |||
import1/ | H | 04-Nov-2019 | - | |||
internal/dlopen/ | H | 04-Nov-2019 | - | |||
journal/ | H | 04-Nov-2019 | - | |||
login1/ | H | 04-Nov-2019 | - | |||
machine1/ | H | 04-Nov-2019 | - | |||
scripts/ | H | 04-Nov-2019 | - | |||
sdjournal/ | H | 04-Nov-2019 | - | |||
unit/ | H | 04-Nov-2019 | - | |||
util/ | H | 04-Nov-2019 | - | |||
v22/ | H | 11-Nov-2019 | - | |||
.travis.yml | H A D | 04-Nov-2019 | 1.5 KiB | |||
CONTRIBUTING.md | H A D | 04-Nov-2019 | 2.6 KiB | |||
DCO | H A D | 04-Nov-2019 | 1.4 KiB | |||
Gopkg.toml | H A D | 04-Nov-2019 | 119 | |||
Jenkinsfile | H A D | 04-Nov-2019 | 773 | |||
LICENSE | H A D | 04-Nov-2019 | 10 KiB | |||
NOTICE | H A D | 04-Nov-2019 | 126 | |||
README.md | H A D | 04-Nov-2019 | 2.9 KiB | |||
code-of-conduct.md | H A D | 04-Nov-2019 | 3 KiB | |||
test | H A D | 04-Nov-2019 | 1.9 KiB |
README.md
1# go-systemd 2 3[![Build Status](https://travis-ci.org/coreos/go-systemd.png?branch=master)](https://travis-ci.org/coreos/go-systemd) 4[![godoc](https://godoc.org/github.com/coreos/go-systemd?status.svg)](http://godoc.org/github.com/coreos/go-systemd) 5![minimum golang 1.10](https://img.shields.io/badge/golang-1.10%2B-orange.svg) 6 7 8Go bindings to systemd. The project has several packages: 9 10- `activation` - for writing and using socket activation from Go 11- `daemon` - for notifying systemd of service status changes 12- `dbus` - for starting/stopping/inspecting running services and units 13- `journal` - for writing to systemd's logging service, journald 14- `sdjournal` - for reading from journald by wrapping its C API 15- `login1` - for integration with the systemd logind API 16- `machine1` - for registering machines/containers with systemd 17- `unit` - for (de)serialization and comparison of unit files 18 19## Socket Activation 20 21An example HTTP server using socket activation can be quickly set up by following this README on a Linux machine running systemd: 22 23https://github.com/coreos/go-systemd/tree/master/examples/activation/httpserver 24 25## systemd Service Notification 26 27The `daemon` package is an implementation of the [sd_notify protocol](https://www.freedesktop.org/software/systemd/man/sd_notify.html#Description). It can be used to inform systemd of service start-up completion, watchdog events, and other status changes. 28 29## D-Bus 30 31The `dbus` package connects to the [systemd D-Bus API](http://www.freedesktop.org/wiki/Software/systemd/dbus/) and lets you start, stop and introspect systemd units. The API docs are here: 32 33http://godoc.org/github.com/coreos/go-systemd/dbus 34 35### Debugging 36 37Create `/etc/dbus-1/system-local.conf` that looks like this: 38 39``` 40<!DOCTYPE busconfig PUBLIC 41"-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN" 42"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> 43<busconfig> 44 <policy user="root"> 45 <allow eavesdrop="true"/> 46 <allow eavesdrop="true" send_destination="*"/> 47 </policy> 48</busconfig> 49``` 50 51## Journal 52 53### Writing to the Journal 54 55Using the pure-Go `journal` package you can submit journal entries directly to systemd's journal, taking advantage of features like indexed key/value pairs for each log entry. 56 57### Reading from the Journal 58 59The `sdjournal` package provides read access to the journal by wrapping around journald's native C API; consequently it requires cgo and the journal headers to be available. 60 61## logind 62 63The `login1` package provides functions to integrate with the [systemd logind API](http://www.freedesktop.org/wiki/Software/systemd/logind/). 64 65## machined 66 67The `machine1` package allows interaction with the [systemd machined D-Bus API](http://www.freedesktop.org/wiki/Software/systemd/machined/). 68 69## Units 70 71The `unit` package provides various functions for working with [systemd unit files](http://www.freedesktop.org/software/systemd/man/systemd.unit.html). 72