#Launch Avahi with Systemd Socket

5 messages · Page 1 of 1 (latest)

regal hare
#

Hi All, I have a relatively simple question about avahi.
Is it possible to launch avahi's daemon on an as-needed basis using a systemd socket.
Cups offers both cups.service and cups.socket however avahi only seems to offer the service.
Avahi chews up a fair amount of my system resources so it'd be nice if i could only launch it when I need to print.

clear plaza
#

ello, i am pretty sure this is possible

#

make a new file in /etc/systemd/system/avahi.socket

chatgpt's example file for this is:

[Unit]
Description=Avahi mDNS/DNS-SD Socket

[Socket]
ListenStream=5353
ListenDatagram=5353

[Install]
WantedBy=sockets.target

activate and start the socket:

sudo systemctl enable avahi.socket
sudo systemctl start avahi.socket

disable and stop the original service:

sudo systemctl disable avahi-daemon.service
sudo systemctl stop avahi-daemon.service

not it will be launched on-demand

#

hopefully this should work