a2ln-server
a2ln-server copied to clipboard
Graphical Notifications Stop Appearing On-Screen, but --command Flag Still Works (Custom systemctl Unit file)
Description
Notifications sometimes do not send, but the --command will run just fine. This may be related to the service dying, but only partially? I don't understand it.
Reproduction
I use Linux Mint Cinnamon, all up-to-date.
The command i use (added in Cinnamon's Startup Applications):
/home/pointblank/.local/bin/a2ln --pairing-port 46351 --notification-port 46352 --title-format "{app} | {title}" --command 'if [ -f ~/.sounds/a2ln/{app}.mp3 ]; then play -Gq --norm=0 ~/.sounds/a2ln/{app}.mp3; else play -Gq --norm=0 ~/.sounds/a2ln/default.mp3; fi'
an additional system file:
Located at: /home/pointblank/.config/systemd/user/a2ln.service
Started by: systemctl --user enable --now a2ln
(should only need to be done once)
[Unit]
Description=Android 2 Linux Notifications Server
[Service]
ExecStart=/home/pointblank/.local/bin/a2ln --pairing-port 46351 --notification-port 46352 --title-format "{app} | {title}" --command 'if [ -f ~/.sounds/a2ln/{app}.mp3 ]; then play -Gq --norm=0 ~/.sounds/a2ln/{app}.mp3; else play -Gq --norm=0 ~/.sounds/a2ln/default.mp3; fi'
RuntimeMaxSec=20m
Restart=always
[Install]
WantedBy=graphical.target
It is worth noting that this unit file attempts to restart the server every 20 minutes. This is my workaround to the server dying periodically and without warning, which resulted in unreliable notifications (unacceptable)
When I notice that the service was partially broken and not showing notifications on screen, and only running the --command (which plays a sound effect), I normally restart it with systemctl --user restart a2ln.service
However, this time I remembered to check the status first:
$ systemctl --user status a2ln.service :
a2ln.service - Android 2 Linux Notifications Server
Loaded: loaded (/home/pointblank/.config/systemd/user/a2ln.service; enabled; vendor preset: enabled)
Active: failed (Result: start-limit-hit) since Sat 2023-05-27 22:43:47 EDT; 1 day 15h ago
Process: 3272658 ExecStart=/home/pointblank/.local/bin/a2ln --pairing-port 46351 --notification-port 46352 --title-format {app} | {title} --command if [ ->
Main PID: 3272658 (code=exited, status=0/SUCCESS)
CPU: 99ms
May 27 22:43:47 monolith systemd[1702]: a2ln.service: Scheduled restart job, restart counter is at 2490.
May 27 22:43:47 monolith systemd[1702]: Stopped Android 2 Linux Notifications Server.
May 27 22:43:47 monolith systemd[1702]: a2ln.service: Start request repeated too quickly.
May 27 22:43:47 monolith systemd[1702]: a2ln.service: Failed with result 'start-limit-hit'.
May 27 22:43:47 monolith systemd[1702]: Failed to start Android 2 Linux Notifications Server.
The message "Start request repeated too quickly." suggests that it is my unit file's 20min restart timer causing an error. But if i change that, then I won't even get sounds when it dies randomly. What should I do? (I will attempt reinstalling A2LN and using the default Unit file / recommended install method until I can confirm again that it does not work reliably. Maybe I am forgetting something...)