AIX

AIX

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

 View Only
  • 1.  script getting error ""/usr/bin/mv: 0403-027 The parameter list is too long

    Posted Fri September 26, 2008 06:10 AM

    Originally posted by: chandru0078


    Dear All

    Please can anyone help to enhance below scripts.I getting "/usr/bin/mv: 0403-027 The parameter list is too long" error when executing below script.So i have tired to change ulimit -f to unlimited but still same .Some people suggested to use xargs but I'm not sure how to apply in my script.
    #################################################
    #!/bin/ksh
    export time=`date +%y%m%d`

    /usr/bin/mkdir /nmonlog/nmon$time

    mv /nmonlog/PRDWLCA2_$time_* /nmonlog/nmon$time

    /usr/bin/tar -cvf nmon$time.tar nmon$time

    /usr/bin/gzip nmon$time.tar

    /usr/bin/rm -rf nmon$time

    ################################################
    find /nmonlog -name 'PRDWLCA2_$time_*' -exec mv {} /nmonlog/nmon$time \;


  • 2.  Re: script getting error ""/usr/bin/mv: 0403-027 The parameter list is too

    Posted Fri September 26, 2008 06:16 AM

    Originally posted by: chandru0078


    If i used below command are working fine,anyway when used like sample 2 instead mv command its not working at all.Anyone can give solution which command can be used ?
    at all.

    Sample 1
    " find /nmonlog -name 'PRDWLCA2_080926_*' -exec mv {} /nmonlog/nmon080926 \; "

    Sample
    find /nmonlog -name 'PRDWLCA2_$time_*' -exec mv {} /nmonlog/nmon$time \;


  • 3.  Re: script getting error ""/usr/bin/mv: 0403-027 The parameter list is too

    Posted Sun October 05, 2008 01:22 PM

    Originally posted by: SystemAdmin


    Just precede your "mv" command with "xargs -t" like this:

    xargs -t mv . . . . .

    The "xargs" command will break the "mv" command arguments into more manageable chunks.


  • 4.  Re: script getting error ""/usr/bin/mv: 0403-027 The parameter list is too

    Posted Sun October 05, 2008 01:28 PM

    Originally posted by: SystemAdmin


    Whoops.
    Didn't read your script carefully.

    Try it like this:

    xargs -t -i mv /nmonlog/PRDWLCA2_$time_{} /nmonlog/nmon$time


  • 5.  Re: script getting error ""/usr/bin/mv: 0403-027 The parameter list is too

    Posted Sun October 05, 2008 04:33 PM

    Originally posted by: SystemAdmin


    I think this might work better.

    cd /nmonlog/PRDWLCA2_$time_
    ls | xargs -t -i mv {} /nmonlog/nmon$time


  • 6.  Re: script getting error ""/usr/bin/mv: 0403-027 The parameter list is too long

    Posted Mon October 06, 2008 04:09 PM

    Originally posted by: hwyguy


    Alternatively, you could also set your ncargs parameter higher.

    We had some issues with the ls command (arg list too long) and set ncargs from 6 (default) to 30 and the issue went away.

    Not sure what AIX version you're using (we're on 5.3 TL07), but this should work.

    Try smitty chgsys and look for "ARG/ENV list size in 4K byte blocks".

    The max you can go to is 1024, but IBM recommended we change the parameter slowly upward until our problems with ls were resolved.

    The change takes effect immediately and is consistent across all reboots.

    Hope this helps.

    -h


  • 7.  Re: script getting error ""/usr/bin/mv: 0403-027 The parameter list is too

    Posted Wed October 15, 2008 01:42 AM

    Originally posted by: chandru0078


    Hi guys
    Thanks for the feedback. I have test suggested way but still not sucesss.Using below line seems nothing being transfered from /nmonlog//PRDWLCA2_$time_{}to /nmonlog/nmon$time. its just hang on execution mode without returning to command prompt line even waited so long.

    xargs -t -i mv /nmonlog/PRDWLCA2_$time_{} /nmonlog/nmon$time

    When try below line its moving what ever files from /nmonlog to /nmonlog/nmon$time. I oly need to transfer PRDWLCA2_$time to /nmonlog/nmon$time but not sure why its transfer ALL files into /nmonlog/nmon$time.May need some touch on below lines
    cd /nmonlog/PRDWLCA2_$time_
    ls | xargs -t -i mv {} /nmonlog/nmon$time

    Can anyone help me again? thanks guys


  • 8.  Re: script getting error ""/usr/bin/mv: 0403-027 The parameter list is too

    Posted Wed April 15, 2009 05:01 PM

    Originally posted by: SystemAdmin


    For future reference.

    ls /nmonlog/ | grep 'PRDWLCA2_$time_' | xargs -t -i mv -f /nmonlog/{} /nmonlog/*<target_folder_name>*/