Update docs

This commit is contained in:
binwiederhier 2025-05-25 12:57:02 -04:00
parent 425e6d064e
commit 7f86108379
3 changed files with 34 additions and 22 deletions

View file

@ -1384,6 +1384,7 @@ and the [ntfy Android app](https://github.com/binwiederhier/ntfy-android/release
* Allow using `NTFY_PASSWORD_HASH` in `ntfy user` command instead of raw password ([#1340](https://github.com/binwiederhier/ntfy/pull/1340), thanks to [@wunter8](https://github.com/wunter8) for implementing)
* You can now change passwords via `v1/users` API ([#1267](https://github.com/binwiederhier/ntfy/pull/1267), thanks to [@wunter8](https://github.com/wunter8) for implementing)
* Make WebPush subscription warning/expiry configurable, increase default to 55/60 days ([#1212](https://github.com/binwiederhier/ntfy/pull/1212), thanks to [@KuroSetsuna29](https://github.com/KuroSetsuna29))
* Support [systemd user service](https://docs.ntfy.sh/subscribe/cli/#using-the-systemd-service) `ntfy-client.service` ([](https://github.com/binwiederhier/ntfy/pull/1002), thanks to [@dandersch](https://github.com/dandersch))
**Bug fixes + maintenance:**

View file

@ -190,6 +190,10 @@ Here's an example config file that subscribes to three different topics, executi
=== "~/.config/ntfy/client.yml (Linux)"
```yaml
default-host: https://ntfy.sh
default-user: phill
default-password: mypass
subscribe:
- topic: echo-this
command: 'echo "Message received: $message"'
@ -210,9 +214,12 @@ Here's an example config file that subscribes to three different topics, executi
fi
```
=== "~/Library/Application Support/ntfy/client.yml (macOS)"
```yaml
default-host: https://ntfy.sh
default-user: phill
default-password: mypass
subscribe:
- topic: echo-this
command: 'echo "Message received: $message"'
@ -226,6 +233,10 @@ Here's an example config file that subscribes to three different topics, executi
=== "%AppData%\ntfy\client.yml (Windows)"
```yaml
default-host: https://ntfy.sh
default-user: phill
default-password: mypass
subscribe:
- topic: echo-this
command: 'echo Message received: %message%'
@ -264,19 +275,30 @@ will be used, otherwise, the subscription settings will override the defaults.
### Using the systemd service
You can use the `ntfy-client` systemd services to subscribe to multiple topics just like in the example above.
You have the option of either enabling `ntfy-client` as a system service (see
[here](https://github.com/binwiederhier/ntfy/blob/main/client/ntfy-client.service))
or user service (see [here](https://github.com/binwiederhier/ntfy/blob/main/client/user/ntfy-client.service)).
The services are automatically installed (but not started) if you install the deb/rpm/AUR package.
The system service ensures that ntfy is run at startup (useful for servers),
while the user service starts ntfy only after the user has logged in. The user service is recommended for personal machine use.
To configure `ntfy-client` as a system service it, edit `/etc/ntfy/client.yml` and run `sudo systemctl restart ntfy-client`.
You have the option of either enabling `ntfy-client` as a **system service** (see [here](https://github.com/binwiederhier/ntfy/blob/main/client/ntfy-client.service))
or **user service** (see [here](https://github.com/binwiederhier/ntfy/blob/main/client/user/ntfy-client.service)). Neither system service nor user service are enabled or started by default, so you have to do that yourself.
To configure `ntfy-client` as a user service it, edit `~/.config/ntfy/client.yml` and run `systemctl --user restart ntfy-client` (without sudo).
**System service:** The `ntfy-client` systemd system service runs as the `ntfy` user. When enabled, it is started at system boot. To configure it as a system
service, edit `/etc/ntfy/client.yml` and then enable/start the service (as root), like so:
!!! info
The system service runs as user `ntfy`, meaning that typical Linux permission restrictions apply. It also means that the system service cannot run commands in your X session as the primary machine user (unlike the user service).
```
sudo systemctl enable ntfy-client
sudo systemctl restart ntfy-client
```
The system service runs as user `ntfy`, meaning that typical Linux permission restrictions apply. It also means that the system service cannot run commands in your X session as the primary machine user (unlike the user service).
**User service:** The `ntfy-client` user service is run when the user logs into their desktop environment. To enable/start it, edit `~/.config/ntfy/client.yml` and
run the following commands (without sudo!):
```
systemctl --user enable ntfy-client
systemctl --user restart ntfy-client
```
Unlike the system service, the user service can interact with the user's desktop environment, and run commands like `notify-send` to display desktop notifications.
It can also run commands that require access to the user's home directory, such as `gnome-calculator`.
### Authentication
Depending on whether the server is configured to support [access control](../config.md#access-control), some topics

View file

@ -40,16 +40,5 @@ if [ "$1" = "configure" ] || [ "$1" -ge 1 ]; then
systemctl restart ntfy-client.service >/dev/null || true
fi
fi
# inform user about systemd user service
echo
echo "------------------------------------------------------------------------"
echo "ntfy includes a systemd user service."
echo "To enable it, run following commands as your regular user (not as root):"
echo
echo " systemctl --user enable ntfy-client.service"
echo " systemctl --user start ntfy-client.service"
echo "------------------------------------------------------------------------"
echo
fi
fi