Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Suggestions on differentiating child processes

by iburrell (Chaplain)
on Nov 12, 2004 at 18:01 UTC ( #407450=note: print w/replies, xml ) Need Help??

in reply to Suggestions on differentiating child processes

It is possible to change the name of process listed by ps by changing the $0 variable.

For example, at work we have a script that runs modules specified on the command line. This is so the modules can be tested. It isn't useful to see that script listed everywhere so it changes the $0 to the module it is running.

Another good example is postgres. The server processes change their name to include the database, user, client address, and command. Makes it very easy to see which command is taking up all the load and tracking it back to a client program.

  • Comment on Re: Suggestions on differentiating child processes

Replies are listed 'Best First'.
Re^2: Suggestions on differentiating child processes
by gnu@perl (Pilgrim) on Nov 12, 2004 at 18:04 UTC
    Changing $0 only works on systems that retreive ps information from the stack, on Solaris and Linux this information is retreived from the /proc filesystem, which you cannot change. Thanks though.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://407450]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2023-12-10 21:05 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (41 votes). Check out past polls.