Oleg Shaikhatarov wrote:
Stas Bekman wrote:Oleg Shaikhatarov wrote:Hello, all! I need to change proctitle (called $PROGRAM_NAME or $0 in perl) of httpd process from mod_perl. Simple change of $0 variable works wellfor standalone perl program, but don't work under mod_perl. I'm not sure if it's possible, but if anyone have an idea how to dothis please help.please give us some more details. What do you do and what doesn'twork. e.g. Apache::Registry sets $0 to the location of the currentlyprocessed script. Why cannot you do the same?Thanks for the response. I need to change program name as it seen by "ps" command. In other words "ps ax | grep http" gives something like:21718 ? S 0:00 /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY 21719 ? S 0:00 /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY 21720 ? S 0:00 /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY 23140 pts/4 S 0:00 grep httpBut I need this output to be: 21718 ? S 0:00 /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY 21719 ? S 0:00 my custom title here 21720 ? S 0:00 my another custom title here 23140 pts/4 S 0:00 grep http And I need to change this from mod_perl.
I understood that. You aren't saying *where* do you need it, that's why I've asked for more details.
If you want to do that for mod_perl handlers, mod_perl sets $0 to the httpd path during the perl_startup (see mod_perl.c:713). Therefore you probably want to write a PerlChildInitHandler that overrides $0.
If you want the same behavior for Registry scripts, which always set $0 to the location of the currently processed script you have to subclass Apache::RegistryNG and override the method set_script_name() which does exactly that.
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:suppressed http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.