Re: Why archives are hanging ... - Mailing list pgsql-www

From Michael Fuhr
Subject Re: Why archives are hanging ...
Date
Msg-id 20051230172711.GA1750@winnie.fuhr.org
Whole thread Raw
In response to Why archives are hanging ...  ("Marc G. Fournier" <scrappy@postgresql.org>)
Responses Re: Why archives are hanging ...  ("Marc G. Fournier" <scrappy@postgresql.org>)
List pgsql-www
On Fri, Dec 30, 2005 at 10:54:57AM -0400, Marc G. Fournier wrote:
> Here is the cause:
>
> root    66170 96.2  0.1  2316  792  ??  RJ    6:59AM 430:11.37 perl -e
> $i=<STDIN>;print substr($i,0,4) . "-" . substr($i,4,2); (perl5.8.7)
>
> Specifically, in my script:
>
>     set fdate = `echo $j | \
>                  awk -F. '{print $4}' | \
>                  perl -e '$i=<STDIN>;print substr($i,0,4) . "-" .
>                  substr($i,4,2);'`
>
>
> Where $j would be equal to something like:
>
> /usr/local/www/archives.postgresql.org/majordomo/pgsql-hackers/files/public/archive/pgsql-hackers.200512
>
> Can someone suggest a cleaner way of doing this?  Specifically, I'm just
> converting the last part (200512) to 2005-12 ...

As for a cleaner way, there's no need to use both awk and perl since
either can do the whole job.  Here are some possibilities:

awk -F. '{print substr($4,1,4) "-" substr($4,5,2)}'
perl -F'\.' -lane 'print substr($F[3],0,4) . "-" . substr($F[3],4,2)'
perl -lne 'if (/\.(\d{4})(\d{2})$/) {print "$1-$2"}'

As for why the existing command is sucking up CPU time, I can't
think of why it would be.  Have you done a process trace?  You
probably won't see anything if it's not making any system calls
but it might be worth checking out.

Does the "J" indicate that the process is running in a jail?  If
so, could that be causing a problem?  Might the process be confused
because it's looking for something (e.g., a device file) that doesn't
exist in the jail?  What OS and version are you using?  Does it
have any known jail bugs?  Can you duplicate this problem in a
controlled test (jailed)?  If so, does it happen if you don't run
in a jail?

--
Michael Fuhr

pgsql-www by date:

Previous
From: "Marc G. Fournier"
Date:
Subject: Why archives are hanging ...
Next
From: "Marc G. Fournier"
Date:
Subject: Re: Why archives are hanging ...