Skip site navigation (1) Skip section navigation (2)

Re: Why archives are hanging ...

From: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: pgsql-www(at)postgresql(dot)org
Subject: Re: Why archives are hanging ...
Date: 2005-12-30 18:54:35
Message-ID: 20051230145103.F1088@ganymede.hub.org (view raw or flat)
Thread:
Lists: pgsql-www
On Fri, 30 Dec 2005, Michael Fuhr wrote:

> 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)}'

Perfect, awk was one of those that I never got anywhere far with, and 
muddled through when I did :(

> 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.

Actually, it only does it semi-randomly, it doesn't do it every time ... 
:(  Have taken out the perl and just using awk now, so we'll see how it 
runs ...

Thanks ...

----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: scrappy(at)hub(dot)org           Yahoo!: yscrappy              ICQ: 7615664

In response to

pgsql-www by date

Next:From: Devrim GUNDUZDate: 2005-12-31 08:21:07
Subject: Re: Initial Upgrade of PgFoundry completed
Previous:From: Michael FuhrDate: 2005-12-30 17:27:12
Subject: Re: Why archives are hanging ...

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group