Loading ...
Sorry, an error occurred while loading the content.

Re: RFE: Make instance name visible in ps output

Expand Messages
  • Victor Duchovni
    ... Is this useful? postmulti -ax /bin/sh -c $daemon_directory/master -t || { echo ${multi_instance_name:--} $(cat $queue_directory/pid/master.pid) } |
    Message 1 of 9 , May 2, 2011
    View Source
    • 0 Attachment
      On Sat, Apr 30, 2011 at 10:08:40PM +0200, Patrick Ben Koetter wrote:

      > > So to find which master is which instance you need to look in the master.pid
      > > files or in /proc, ... If you do look in /proc, each child process has
      > > MAIL_CONFIG in its environment...
      >
      > I see, and I don't want to sound ungrateful, but I was looking for something
      > simpler.

      Is this useful?

      postmulti -ax /bin/sh -c '
      $daemon_directory/master -t || {
      echo ${multi_instance_name:--} $(cat $queue_directory/pid/master.pid)
      }' |
      while read iname pid
      do
      ps -p $(pgrep -P $pid) | sed -e "s/^/$iname /"
      done

      For cut/paste the one-line version:

      postmulti -ax /bin/sh -c '$daemon_directory/master -t || { echo ${multi_instance_name:--} $(cat $queue_directory/pid/master.pid); }' | while read iname pid; do ps -p $(pgrep -P $pid) | sed -e "s/^/$iname /"; done

      --
      Viktor.
    • Patrick Ben Koetter
      ... Definitely! I ran it on a machine that has four instances of whom two weren t running and it failed on the first one not running. Could it be the script
      Message 2 of 9 , May 2, 2011
      View Source
      • 0 Attachment
        * Victor Duchovni <postfix-users@...>:
        > On Sat, Apr 30, 2011 at 10:08:40PM +0200, Patrick Ben Koetter wrote:
        >
        > > > So to find which master is which instance you need to look in the master.pid
        > > > files or in /proc, ... If you do look in /proc, each child process has
        > > > MAIL_CONFIG in its environment...
        > >
        > > I see, and I don't want to sound ungrateful, but I was looking for something
        > > simpler.
        >
        > Is this useful?

        Definitely! I ran it on a machine that has four instances of whom two weren't
        running and it failed on the first one not running. Could it be the script
        does not handle such situations?

        p@rick


        >
        > postmulti -ax /bin/sh -c '
        > $daemon_directory/master -t || {
        > echo ${multi_instance_name:--} $(cat $queue_directory/pid/master.pid)
        > }' |
        > while read iname pid
        > do
        > ps -p $(pgrep -P $pid) | sed -e "s/^/$iname /"
        > done
        >
        > For cut/paste the one-line version:
        >
        > postmulti -ax /bin/sh -c '$daemon_directory/master -t || { echo ${multi_instance_name:--} $(cat $queue_directory/pid/master.pid); }' | while read iname pid; do ps -p $(pgrep -P $pid) | sed -e "s/^/$iname /"; done
        >
        > --
        > Viktor.

        --
        All technical questions asked privately will be automatically answered on the
        list and archived for public access unless privacy is explicitely required and
        justified.

        saslfinger (debugging SMTP AUTH):
        <http://postfix.state-of-mind.de/patrick.koetter/saslfinger/>
      • Victor Duchovni
        ... You of all people should be able to better explain what failed means... The script tests the master.pid lock, and only reports child processes when the
        Message 3 of 9 , May 2, 2011
        View Source
        • 0 Attachment
          On Mon, May 02, 2011 at 09:38:08PM +0200, Patrick Ben Koetter wrote:

          > * Victor Duchovni <postfix-users@...>:
          > > On Sat, Apr 30, 2011 at 10:08:40PM +0200, Patrick Ben Koetter wrote:
          > >
          > > > > So to find which master is which instance you need to look in the master.pid
          > > > > files or in /proc, ... If you do look in /proc, each child process has
          > > > > MAIL_CONFIG in its environment...
          > > >
          > > > I see, and I don't want to sound ungrateful, but I was looking for something
          > > > simpler.
          > >
          > > Is this useful?
          >
          > Definitely! I ran it on a machine that has four instances of whom two weren't
          > running and it failed on the first one not running. Could it be the script
          > does not handle such situations?

          You of all people should be able to better explain what "failed" means...
          The script tests the master.pid lock, and only reports child processes
          when the master is running. What went wrong in your case? It is a simple
          enough "script" (pretty much a one-liner), likely you can improve it...

          --
          Viktor.
        • Patrick Ben Koetter
          ... Apologies for being that terse. I ran the script on a host whose details I may not expose in public. I ll get hold of a better test environment and I will
          Message 4 of 9 , May 2, 2011
          View Source
          • 0 Attachment
            * Victor Duchovni <postfix-users@...>:
            > > > Is this useful?
            > >
            > > Definitely! I ran it on a machine that has four instances of whom two weren't
            > > running and it failed on the first one not running. Could it be the script
            > > does not handle such situations?
            >
            > You of all people should be able to better explain what "failed" means...
            > The script tests the master.pid lock, and only reports child processes
            > when the master is running. What went wrong in your case? It is a simple
            > enough "script" (pretty much a one-liner), likely you can improve it...

            Apologies for being that terse. I ran the script on a host whose details I may
            not expose in public. I'll get hold of a better test environment and I will
            improve it if I can.

            p@rick

            --
            All technical questions asked privately will be automatically answered on the
            list and archived for public access unless privacy is explicitely required and
            justified.

            saslfinger (debugging SMTP AUTH):
            <http://postfix.state-of-mind.de/patrick.koetter/saslfinger/>
          • Wietse Venema
            FYI, there exists no standard function to set the process title . BSD has setproctitle() in the system library which as the manpage says, is implicitly
            Message 5 of 9 , May 2, 2011
            View Source
            • 0 Attachment
              FYI, there exists no standard function to set the "process title".
              BSD has setproctitle() in the system library which as the manpage
              says, is "implicitly non-standard".

              Other systems don't have an equivalent in their system library, as
              far as I know. I prefer not to maintain Postfix's own version.
              Such code mucks with the argv array and is totally non-portable.

              Wietse
            Your message has been successfully submitted and would be delivered to recipients shortly.