Обсуждение: Why archives are hanging ...

Поиск
Список
Период
Сортировка

Why archives are hanging ...

От
"Marc G. Fournier"
Дата:
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 ...

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

Re: Why archives are hanging ...

От
Michael Fuhr
Дата:
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

Re: Why archives are hanging ...

От
"Marc G. Fournier"
Дата:
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@hub.org           Yahoo!: yscrappy              ICQ: 7615664