Link to home
Start Free TrialLog in
Avatar of Oranew
Oranew

asked on

which files are getting changed during the run process

I am running a process and that process updates more than 50 files.
I like to know what are the files got changed during this process.
The process is a shell script. I just like to know the file names and the full location of these files. I know the root directory which is
/app/psoft/psoft92

the script location is /app/psoft/scripts

The requirement is as follows:-
I copied the scripts directory from one server to the new server and it is not working on the new server. I will run this on the old server and find if all the directories exists on the new server.
Avatar of simon3270
simon3270
Flag of United Kingdom of Great Britain and Northern Ireland image

Before you start the process,

    touch /tmp/markstart

then run the process and afterwards get a list of files changed since the"touch" with

    find /app/psoft/psoft92 -newer /tmp/markstart

(edit to correct path after "find" command - copied the wrong text from your question - I can't get the hang of EE on mobile devices!)
Avatar of Oranew
Oranew

ASKER

This does not work
In whatway?  No output?  Too much output?

Were any files updated on the server you tested on?  If you know at least one file which definitely *is* changed, do an "ls -l" on it before running the script, and then again afterwards.  Has the date and time changed?  If not, we'll have to think of another way.

If the problem is just that directories don't exist on the 2nd server. you can justcreate the same directory structure as is on the first machine.  Go to the first machine and:
    cd /app/psoft/psoft92
    find . -type d > /tmp/psoftdirs

Then copy /tmp/psoftdirs to /tmp on the second machine, and on that second machine
    cd /app/psoft/psoft92
    cat /tmp/psoftdirs | xargs mkdir -p
One other thing - the "-newer" test will only report files which are changed, it won't report files which the script reads (such as configuration files).  You *may* be able to find these by checking the "last access time" rather than the "last modification time", but that is not always reliable (it depends whether checking a files's access time is counted as an "access").  The other way is to run "strace" on the script - that reports all system calls that the scipt makes, including file access - it will probbaly be an enourmous file, but it should be possible to extract a list of unique file names.
Avatar of Oranew

ASKER

The solution did not give any output but errors on find.
As no one else answered this question and I don't have the right answer I will request to go ahead and close it.

This solution is not working for me but it may have worked for the expert
What errors? If, for example, your "find" doesn't support "-newer", we'll have to think again.

As you may have seen in some of my other answers, I hate to give up!
ASKER CERTIFIED SOLUTION
Avatar of Oranew
Oranew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OK, if all we are going to get is "it didn't work", I have no objection to the close.
Avatar of Oranew

ASKER

No solution worked
I see from other questions that you are using Solaris. This may be why my commands did not work. If you had either mentioned this, or said what had actually failed, we might have got further.

I would normally suggest that you deleted the question rather than accept your own answer (particularly since your "answer" is nothing of the sort), but my answers are perfectly good for Linux, so might help others.