Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
activation/ | H | 02-Jun-2020 | - | 487 | 280 | |
daemon/ | H | 02-Jun-2020 | - | 325 | 188 | |
dbus/ | H | 02-Jun-2020 | - | 3,488 | 2,357 | |
examples/activation/ | H | 02-Jun-2020 | - | 278 | 148 | |
fixtures/ | H | 03-May-2022 | - | 44 | 30 | |
import1/ | H | 02-Jun-2020 | - | 411 | 299 | |
internal/dlopen/ | H | 02-Jun-2020 | - | 147 | 91 | |
journal/ | H | 02-Jun-2020 | - | 348 | 233 | |
login1/ | H | 02-Jun-2020 | - | 429 | 314 | |
machine1/ | H | 02-Jun-2020 | - | 468 | 351 | |
scripts/ | H | 02-Jun-2020 | - | 134 | 108 | |
sdjournal/ | H | 02-Jun-2020 | - | 2,007 | 1,177 | |
unit/ | H | 02-Jun-2020 | - | 2,010 | 1,506 | |
util/ | H | 02-Jun-2020 | - | 371 | 183 | |
.gitignore | H A D | 02-Jun-2020 | 10 | 2 | 1 | |
.travis.yml | H A D | 02-Jun-2020 | 1.4 KiB | 45 | 38 | |
CONTRIBUTING.md | H A D | 02-Jun-2020 | 2.6 KiB | 78 | 55 | |
DCO | H A D | 02-Jun-2020 | 1.4 KiB | 37 | 27 | |
Jenkinsfile | H A D | 02-Jun-2020 | 773 | 38 | 32 | |
LICENSE | H A D | 02-Jun-2020 | 10 KiB | 192 | 155 | |
NOTICE | H A D | 02-Jun-2020 | 126 | 6 | 4 | |
README.md | H A D | 02-Jun-2020 | 3 KiB | 74 | 47 | |
code-of-conduct.md | H A D | 02-Jun-2020 | 3 KiB | 62 | 47 | |
go.mod | H A D | 02-Jun-2020 | 91 | 6 | 3 | |
go.sum | H A D | 02-Jun-2020 | 169 | 3 | 2 | |
test | H A D | 02-Jun-2020 | 1.9 KiB | 88 | 53 |
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://img.shields.io/badge/godoc-reference-5272B4)](https://pkg.go.dev/mod/github.com/coreos/go-systemd/v22/?tab=packages) 5![minimum golang 1.12](https://img.shields.io/badge/golang-1.12%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). 28It can be used to inform systemd of service start-up completion, watchdog events, and other status changes. 29 30## D-Bus 31 32The `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. 33[API documentation][dbus-doc] is available online. 34 35[dbus-doc]: https://pkg.go.dev/github.com/coreos/go-systemd/v22/dbus?tab=doc 36 37### Debugging 38 39Create `/etc/dbus-1/system-local.conf` that looks like this: 40 41``` 42<!DOCTYPE busconfig PUBLIC 43"-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN" 44"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> 45<busconfig> 46 <policy user="root"> 47 <allow eavesdrop="true"/> 48 <allow eavesdrop="true" send_destination="*"/> 49 </policy> 50</busconfig> 51``` 52 53## Journal 54 55### Writing to the Journal 56 57Using 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. 58 59### Reading from the Journal 60 61The `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. 62 63## logind 64 65The `login1` package provides functions to integrate with the [systemd logind API](http://www.freedesktop.org/wiki/Software/systemd/logind/). 66 67## machined 68 69The `machine1` package allows interaction with the [systemd machined D-Bus API](http://www.freedesktop.org/wiki/Software/systemd/machined/). 70 71## Units 72 73The `unit` package provides various functions for working with [systemd unit files](http://www.freedesktop.org/software/systemd/man/systemd.unit.html). 74