AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
#Power
 View Only
  • 1.  find command help

    Posted Fri December 04, 2009 04:43 PM

    Originally posted by: rob_hansen


    Hello,

    I am using the following find command in a shell script to find orphan files (files with no UID/GID) on AIX servers. It works for fine for most of the servers but fails for a few. The code and error are below:
    case "$OSNAME" in
    AIX) print "Orphan files found..."
    nice find / -name "/proc" -prune -o \
    \( -fstype jfs -o -fstype jfs2 \) -a \( -nouser -o -nogroup \) -print | xargs ls -ld

    The error:

    ls: 0653-341 The file /opt/wily/EM1/Baseline/Individual does not exist.
    ls: 0653-341 The file JVM does not exist.
    ls: 0653-341 The file Alert does not exist.
    ls: 0653-341 The file MM/JWG36.jar does not exist.
    Please help. Thanks.
    #AIX-Forum


  • 2.  Re: find command help

    Posted Fri December 04, 2009 07:24 PM

    Originally posted by: jnordtome


    Take a look at the /opt/wily/EM1/Baseline directory and look to see if there are any files with spaces in their names. This can cause the errors you are seeing.

    My guess is that there's a file called "/opt/wily/EM1/Baseline/Individual JVM Alert MM/JWG36.jar"
    #AIX-Forum


  • 3.  Re: find command help

    Posted Sun December 06, 2009 02:55 PM

    Originally posted by: shargus


    What if you took the "| xargs ls -ld" off?
    #AIX-Forum


  • 4.  Re: find command help

    Posted Mon December 07, 2009 05:30 PM

    Originally posted by: rob_hansen


    jnordtome....you are right the filename had spaces in it. However, I cannot control the way a file is named..that being said. I changed the code to ( -fstype jfs -o -fstype jfs2 \) -a \( -nouser -o -nogroup \) -exec ls -ld {} +
    This code is working fine for servers that have filenames with spaces but fails for a clean server (when there are no files with invalid UID/GID) as shown below:
    find: 0652-083 Cannot execute :: A file or directory in the path name does not exist.

    Any advice on this??

    Thanks.
    #AIX-Forum


  • 5.  Re: find command help

    Posted Tue December 08, 2009 05:04 PM

    Originally posted by: jnordtome


    I'm unsure what the "+" character at the end of your statement does. Normally my find\exec statements are ended with a "\;"

    This appears to work in my testing. Give it a shot and let us know if it still doesn't work.
    #AIX-Forum