admin管理员组

文章数量:1389379

Following the example described here, I created the .path and the .service thus:

[Unit]
Description=Watch for Foo in %i

[Install]
WantedBy=multi-user.target

[Path]
PathChanged=/tmp/%i.dbstatus

and the Foo.service is simply:

[Unit]
Description=Process status-changes in %i

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
ExecStart=/bin/bash -c "exec >> %h/mxapps/%i/logs/Foo.log 2>&1; date; env"

As in the example, whenever the contents of the /tmp/Bar.dbstatus changes, the service is triggered -- hurrah! The removal of the file triggers the service too -- very good.

However, when I try to create the name as a ("broken") symlink: ln -s Meow /tmp/Bar.dbstatus, there is no reaction...

I'd like to use the symlinks, because -- unlike a sequence of open(), write(), and close() -- the symlink() is atomic (and so is the readlink()).

Is there anything I can tweak for systemd to react? Using PathModified instead of PathChanged didn't help...

(Systemd on RHEL7 is quite old -- version 219.)

本文标签: rhel7Systemd pathunit for a symlinkStack Overflow