Results 1 to 3 of 3

Thread: [RESOLVED] Changing the process name.

  1. #1

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Resolved [RESOLVED] Changing the process name.

    I want to fork my app into 4 processes and have a unique name for each one that shows up in `top`. Currently, top shows the same process name for each process (eg the name inherited from the parent process) which makes life difficult when trying to kill a specific process.

    Is this even possible? I'm already using the argv[0] trick to change the command line for the forked processes but this doesn't show up in `top`.

    I'm coding in C under Linux and Solaris by the way.
    I don't live here any more.

  2. #2
    Hyperactive Member CyberSurfer's Avatar
    Join Date
    Aug 2000
    Location
    Old London Town
    Posts
    425

    Re: Changing the process name.

    You can use top with the -c option to view the entire command line instead of just the command name.

    Also, if you run

    Code:
    ps -axjf
    It will give you a process tree and preserve command line arguments which can be useful for making sure you don't kill the parent
    Last edited by CyberSurfer; Jun 13th, 2008 at 05:03 AM.

  3. #3

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Changing the process name.

    Yeah that's what we were having to do previously.

    Anyway, a colleague of mine found a nice undocumented feature and it seems to work...

    http://www.vbforums.com/showthread.p...55#post3256555
    I don't live here any more.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width