I would like to see what's happening in my app server folders, i.e. which files are changed by process x or which
*.war files have been changed (replaced/created) in the last x minutes.
Is there a tool in Linux to help with this?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
Strace (as outlined above) is one way to check the actions of a specified running software.
Some command like
watch find dir/ -mmin 1 may also help to check for changes of the past minute in some directory.
Depending on what exactly you're looking for, inotify-tools is probably another tool of trade here.
inotifywait -mr dir/ monitors changes in the given directory and instantly gives you feedback of any application trying to open/read/write/close a file. However, inotify doesn't give you feedback on which application or process is accessing the file - that's something strace does do.
Please do know system-level monitoring is usually of limited use for java software running in some application container environment, as you only do see the container (e.g. Tomcat), but not the actual application (e.g. .war)) interacting with the system.
You can get information about which files accessed by process by lsof:
lsof -n -p `pidof your_app`
And vice verse, you can get pid of process that write/read to some file:
lsof -n -t file