我从 unix.StackOverflow 复制了这个问题到这里
当我开箱即用地使用 incrontab 时,我的意思是没有任何变化,我没有得到任何结果,就好像没有执行 cmd 一样。
我的 incron 行是:/crrae IN_CREATE、IN_CLOSE_WRITE、IN_MOVED_TO /usr/bin/unix2dos $#
日志提供的信息好像一切都正常,但实际上并非如此
生成的strace是:incrontab_trace_0.txt
0.000000 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}, {fd=8, events=POLLIN}], 3, -1) = 1 ([{fd=8, revents=POLLIN}])
17.616276 read(8, "\1\0\0\0\0\1\0\0\0\0\0\0000\0\0\0ExportSageJDE_CO"..., 32768) = 64
0.000145 stat64("/crrae", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
0.000147 time(NULL) = 1399228077
0.000056 stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=156, ...}) = 0
0.000089 stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=156, ...}) = 0
0.000082 stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=156, ...}) = 0
0.000096 send(3, "<78>May 4 18:27:57 incrond[3183"..., 108, MSG_NOSIGNAL) = 108
0.000104 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7f60718) = 31838
0.000816 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}, {fd=8, events=POLLIN}], 3, -1) = -1 EINTR (Interrupted system call)
0.000834 --- SIGCHLD (Child exited) @ 0 (0) ---
0.000033 read(4, 0x8069c40, 32) = -1 EAGAIN (Resource temporarily unavailable)
0.000057 write(5, "X", 1) = 1
0.000056 sigreturn() = ? (mask now [])
0.000072 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}, {fd=8, events=POLLIN}], 3, -1) = 1 ([{fd=4, revents=POLLIN}])
0.000068 read(4, "X", 1) = 1
0.000054 read(4, 0xbfd22dd9, 1) = -1 EAGAIN (Resource temporarily unavailable)
0.000057 waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], WNOHANG) = 31838
0.000060 waitpid(-1, 0xbfd22dd4, WNOHANG) = -1 ECHILD (No child processes)
0.000051 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}, {fd=8, events=POLLIN}], 3, -1) = 1 ([{fd=8, revents=POLLIN}])
0.009198 read(8, "\1\0\0\0\10\0\0\0\0\0\0\0000\0\0\0ExportSageJDE_CO"..., 32768) = 64
0.000074 stat64("/crrae", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
0.000118 time(NULL) = 1399228077
0.000057 stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=156, ...}) = 0
0.000084 stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=156, ...}) = 0
0.000082 stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=156, ...}) = 0
0.000090 send(3, "<78>May 4 18:27:57 incrond[3183"..., 108, MSG_NOSIGNAL) = 108
0.000065 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7f60718) = 31839
0.000614 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}, {fd=8, events=POLLIN}], 3, -1) = -1 EINTR (Interrupted system call)
0.000832 --- SIGCHLD (Child exited) @ 0 (0) ---
0.000026 read(4, 0x8069c40, 32) = -1 EAGAIN (Resource temporarily unavailable)
0.000055 write(5, "X", 1) = 1
0.000054 sigreturn() = ? (mask now [])
0.000071 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}, {fd=8, events=POLLIN}], 3, -1) = 1 ([{fd=4, revents=POLLIN}])
0.000067 read(4, "X", 1) = 1
0.000053 read(4, 0xbfd22dd9, 1) = -1 EAGAIN (Resource temporarily unavailable)
0.000051 waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], WNOHANG) = 31839
0.000058 waitpid(-1, 0xbfd22dd4, WNOHANG) = -1 ECHILD (No child processes)
0.000050 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}, {fd=8, events=POLLIN}], 3, -1 <unfinished ...>
当我将 incron 更改为:
/crrae IN_CREATE,IN_CLOSE_WRITE,IN_MOVED_TO /usr/bin/unix2dos /crrae/$#
或者
/crrae IN_CREATE,IN_CLOSE_WRITE,IN_MOVED_TO /usr/bin/unix2dos $@/$#
日志给了我这个:
May 4 18:15:10 srvovs incrond[20859]: (root) CMD (/usr/bin/unix2dos /crrae/u2dtmpPbqoFd)
May 4 18:15:10 srvovs incrond[20859]: (root) CMD (/usr/bin/unix2dos /crrae/u2dtmpN2Odxf)
May 4 18:15:10 srvovs incrond[20859]: (root) CMD (/usr/bin/unix2dos /crrae/u2dtmpN2Odxf)
多次之后,incron.conf 仍未修改。有什么想法吗?