I have added a systemd service to monitor a path, but it is not working. I touched a .txt file under /tmp/test/, but it is not kicking in my service. I can't see "/tmp/testlog.txt" getting generated. Is there anything wrong in my service?
[Unit] Description=Path Exists [Path] PathExistsGlob=/tmp/test/*.txt PathChanged=/tmp/test/ [Install] WantedBy=multi-user.target
[Unit] Description=Test [Service] ExecStartPre=/bin/sh -c 'mkdir /tmp/test && sleep 60' ExecStart=/bin/sh -c 'echo "Test Success" >> /tmp/testlog.txt & ' [Install] WantedBy=multi-user.target
# ls /tmp/test/ ab.txt #
What could be the reason for the failure?