---
name: "Linux::Systemd::Daemon"
section: "3pm"
platform: "linux"
package: "liblinux-systemd-perl"
version: "1.201600-4+b4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Linux::Systemd::Daemon"
---

# Linux::Systemd::Daemon(3pm)

Systemd daemon API

## NAME

Linux::Systemd::Daemon - Systemd daemon API

## VERSION

version 1.201600

## SYNOPSIS

```
  use Linux::Systemd::Daemon 'sd_ready';
  # program initialisation
  sd_ready;
  while (1) {
      sd_notify(watchdog => 1, status => 'Main loop running');
      # do something here
  }
  sd_notify(stopping => 1, status => 'Shutting down...');
```

## DESCRIPTION

An XS wrapper for sd-daemon \<https://www.freedesktop.org/software/systemd/man/sd-daemon.html\>, the systemd daemon interface.

Exports one function, "sd\_notify", by default. A variety of convenience functions are also available for import, either individually or with the `":all"` tag.

For a fully featured example, see the `"perl-daemon"` script and `"perl-daemon.service"` examples in `"eg"`.

## FUNCTIONS

### sd\_notify(@array\_of\_pairs)

The main function, exported by default. Takes a list of pairs and converts them to a string to be passed to the C function **man:sd\_notify**(3) \<https://www.freedesktop.org/software/systemd/man/sd\_notify.html\>

e.g.

```
  sd_notify(ready => 1, status => 'Processing requests');
```

### sd\_watchdog()

Convenience function. Optional export.

### sd\_ready()

Convenience function. Optional export.

### sd\_stopping()

Convenience function. Optional export.

### sd\_reloading()

Convenience function. Optional export.

### "sd\_status(Str $status\_message)"

Convenience function. Optional export.

## SEE ALSO

https://www.freedesktop.org/software/systemd/man/sd-daemon.html

## AUTHOR

Ioan Rogers \<ioanr@cpan.org\>

## COPYRIGHT AND LICENSE

This software is Copyright (c) 2020 by Ioan Rogers.

This is free software, licensed under:

```
  The GNU Lesser General Public License, Version 2.1, February 1999
```
