Skip to content

ronilaukkarinen/ntfy-linux-receiver-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

ntfy.sh listener service for Linux

This simple script listens for ntfy notifications and displays them as desktop notifications on Linux. It is intended to be run as a systemd service in the background.

Screenshot from 2024-11-03 21-55-33

Prequisites

Ensure you have curl, jq, and notify-send installed on your system.

Download the logo from the ntfy documentation to use in the notifications:

wget -O /path/to/ntfy.png https://docs.ntfy.sh/static/img/ntfy.png

Replace /path/to/ntfy.png in the script with the actual path where you saved the logo image.

Save the script and make it as executable.

sudo chmod +x /usr/local/bin/ntfy-listener.sh

Create the systemd service file

Create a systemd service to automatically start the listener on boot. Create the service file /etc/systemd/system/ntfy-listener.service, remember to replace my user name with your username:

[Unit]
Description=Ntfy Listener Service
After=network-online.target
Wants=network-online.target

[Service]
ExecStart=/usr/local/bin/ntfy-listener.sh
Restart=on-failure
RestartSec=10
User=rolle
Environment=DISPLAY=:0
Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target

Enable and start the service:

sudo systemctl enable ntfy-listener.service --now

The service will now automatically start on boot and display notifications from the configured ntfy channels.

If you need to add more channels, simply update the NTFY_URLS array in the script.

About

Subscribe to ntfy endpoints by using a systemd service only.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages