The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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, 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)

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