malongshuai / malongshuai.github.io

2 stars 0 forks source link

systemd path:实时监控文件和目录的变动 | 骏马金龙 #130

Open malongshuai opened 4 years ago

malongshuai commented 4 years ago

https://www.junmajinlong.com/linux/systemd/systemd_path/

systemd path:实时监控文件和目录的变动

dragonfireshine commented 2 years ago

亲,在CentOS7.6中,使用systemd-run命令临时监控路径的命令报错,是哪里错了吗?
[root@localhost ~]# systemd-run --path-property=PathModified=/tmp/a.log echo 'file changed'
systemd-run: unrecognized option '--path-property=PathModified=/tmp/a.log'

[root@localhost ~]# systemd-run --property=PathModified=/tmp/a.log /usr/bin/echo 'file changed'
Unknown assignment PathModified=/tmp/a.log.
Failed to create bus message: No such device or address

[root@localhost ~]# systemd-run --property=PathModified=/tmp/a.log "/usr/bin/echo 'file changed'"
Failed to find executable /usr/bin/echo 'file changed': No such file or directory

dragonfireshine commented 2 years ago

[root@localhost ~]# systemd-run --version
systemd 219
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYT +GNUTLS +ACL +XZ +LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN