Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Suggestions on differentiating child processes

by iburrell (Chaplain)
on Nov 12, 2004 at 18:01 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-25 22:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found