tar*_*yte 6 linux monitoring lsof files
我有一个配置文件,想了解哪些可执行文件正在使用它(如果有)。我想知道谁是这个文件的读者。
如果我watch有一些间隔,我会想念它,因为读取发生得如此之快:
watch -d -n 1 "lsof /home/me/my.conf"
Run Code Online (Sandbox Code Playgroud)
如果我尝试执行该程序,我很确定在 的支持下使用它strace,它会由于strace引入的额外延迟而失败。
strace -o /tmp/$(date +%s)_myprog.trace myprog
Run Code Online (Sandbox Code Playgroud)
我怎样才能可靠地证明myprog没有读取这个文件?
观察一个进程打开了哪些文件,或者哪些进程打开了一个文件,这对于sysdig.
基本 opensnoop:snoop 文件在它们发生时打开
Run Code Online (Sandbox Code Playgroud)sysdig -p "%12user.name %6proc.pid %12proc.name %3fd.num %fd.typechar %fd.name" evt.type=open观察所有名为 my.conf 的文件的 I/O 活动
Run Code Online (Sandbox Code Playgroud)sysdig -A -c echo_fds "fd.filename=my.conf"
名称 sysdig - 权威的系统和流程故障排除工具
概要 sysdig [选项]... [过滤器]
描述。
Run Code Online (Sandbox Code Playgroud)sysdig is a tool for system troubleshooting, analysis and explo? ration. It can be used to capture, filter and decode system calls and other OS events. sysdig can be both used to inspect live systems, or to generate trace files that can be analyzed at a later stage. sysdig includes a powerul filtering language, has customizable out? put, and can be extended through Lua scripts, called chisels.