[systemd-devel] Notify type service as non-root user fails

KIESEL, BRIAN S bk9825 at att.com
Mon Jul 15 13:33:50 UTC 2019


I have a simple example of a service unit and bash script on rhel7 using Type=notify that I was trying to get working.  When the service unit is configured to  start the script as root things work as expected.  When adding User=testuser it fails.  While the script initially starts (as seen on process list), Journalct -xe reports many lines like the following and the service eventually timesout.  I am not even clear what these referenced PIDs are associated with as they don't exist in the process list.

Jul 15 13:37:25 tstcs03.ingdev systemd[1]: Cannot find unit for notify message of PID 7193.
Jul 15 13:37:28 tstcs03.ingdev systemd[1]: Cannot find unit for notify message of PID 7290.
Jul 15 13:37:31 tstcs03.ingdev systemd[1]: Cannot find unit for notify message of PID 7388.
Jul 15 13:37:34 tstcs03.ingdev systemd[1]: Cannot find unit for notify message of PID 7480.

[Unit]
Description=My Test
[Service]
Type=notify
User=testuser
ExecStart=/home/iatf/test.sh
[Install]
WantedBy=multi-user.target


Test.sh (owned by testuser with execute permission)
#!/bin/bash

systemd-notify --status="Starting..."
sleep 5
systemd-notify --ready --status="Started"

while [ 1 ] ; do
  systemd-notify --status="Processing..."
  sleep 3
  systemd-notify --status="Waiting..."
  sleep 3
done

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190715/71f1b5a3/attachment.html>


More information about the systemd-devel mailing list