nazov perl programu pre top

Michal Buchtik buchtajz at borsice.net
Sun Feb 5 19:47:21 CET 2012


google me vyplivnul stranku kde bylo tohle:

$0
Contains the name of the file containing the perl script being executed. 
Assigning to $0 modifies the argument area that the ps(1)
program sees. (Mnemonic: same as sh and ksh.)

zkusil sem:

#!/usr/bin/perl
print `ps`;
$0 = 'pokus-perl';
print `ps`;


   PID  TT  STAT    TIME COMMAND
   3957   1  S+   0:00,00 /usr/bin/perl ./test.pl (perl5.12.4)
   3958   1  R+   0:00,00 ps
   PID  TT  STAT    TIME COMMAND
   3957   1  S+   0:00,01 pokus-perl (perl5.12.4)
   3959   1  R+   0:00,00 ps

staci tak?

Michal

Dne 2012/02/05 19:09, Jozef Drahovsky napsal(a):
> V tuto neskoru nedelnu hodinu mam jednu jednoduchu otazku:
>
> Ako definovat nazov programu v perle psutaneho zo shellu alebo cronu,
> najlepsie definicia za #! aby v programe top bol identifikovatelny
> a nesvietilo u vsetkych programov perlx.x.x ?
>
> ps
> 15394  p0  S      0:00.01 /usr/bin/perl ./a (perl5.8.9)
> 15594  p0  S      0:00.01 /usr/bin/perl ./b (perl5.8.9)
> top
> 14562 root               1  44    0  3148K  1236K select   7:36  0.00% 
> syslog-ng
> 15594 root               1   8    0  4568K  1776K nanslp   0:00  0.00% 
> perl5.8.9
> 15394 root               1   8    0  4568K  1776K nanslp   0:00  0.00% 
> perl5.8.9
> 14767 root               1  44    0 23812K 12356K select   2:00  0.00% 
> httpd
>
>
> Vie niekto poradit?
> Jozef


More information about the Users-l mailing list