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

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to