Linux:...Daemon(3pm)

πŸ’– Linux::Systemd::Daemon(3pm) πŸ’–

okay bestie, welcome to Linux::Systemd::Daemon β€” that's the manual page name, and it lives in the User Contributed Perl Documentation section of the man pages. she's here to let your Perl program talk to systemd like a whole grown-up daemon. let's get into it 🫢


✨ NAME ✨

Linux::Systemd::Daemon β€” the Systemd daemon API, but make it Perl. πŸ’…


🌸 VERSION 🌸

version 1.201600 β€” this is the one we're working with, no cap.


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the whole vibe, literally:

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...');

look at her go 😭 she's initialising, she's looping, she's shutting down politely. main character energy fr fr.


πŸ’œ DESCRIPTION πŸ’œ

so this is an XS wrapper for sd-daemon β€” the official systemd daemon interface, which you can read all about at https://www.freedesktop.org/software/systemd/man/sd-daemon.html. it's basically a little Perl-shaped doorway into the C world, and it slays.

by default it exports one function: sd_notify. that's it. that's the default girl.

but wait, there's more πŸ‘‘ β€” a whole variety of convenience functions are also available for import, either individually or all together with the :all tag. so you can cherry-pick or take the whole squad, your call bestie.

if you want the fully featured, no-holds-barred example, go peep the perl-daemon script and the perl-daemon.service examples hanging out in eg. they're iconic.

πŸŽ€ FUNCTIONS πŸŽ€

πŸ’« sd_notify(@array_of_pairs)

the main function, and the one exported by default, iykyk. she takes a list of pairs and converts them into a string that gets passed along to the C function sd_notify(3) at https://www.freedesktop.org/software/systemd/man/sd_notify.html.

like, for example:

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

so simple, so elegant, so her. ✨

πŸ’« 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. she takes a status message and that's the whole thing, periodt. πŸ’…


🌈 SEE ALSO 🌈

https://www.freedesktop.org/software/systemd/man/sd-daemon.html β€” the source of truth, go read her.


πŸ‘‘ AUTHOR πŸ‘‘

Ioan Rogers <ioanr@cpan.org> β€” the legend responsible for all of this. give her her flowers. 🌸


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

and it's free software, licensed under:

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

okay that's the whole page bestie, you ate it πŸ’… this was generated from perl v5.42.3 and dated 2026-08-20, and it's the <pink>Linux:...Daemon(3pm)</pink> page from User Contributed Perl Documentation. go write a daemon, you're gonna be so good at it πŸ¦‹βœ¨πŸ’–

πŸ“¦ where this page comes from