Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

How do I prevent the command/parameters in a system call from displaying in ps

( #14579=categorized question: print w/ replies, xml ) Need Help??
Contributed by infoninja on May 24, 2000 at 20:09 UTC
Q&A  > programs and processes


Description:

I'm putting coding a perl program that needs to use system() a number of times. In a couple of the uses of system(), I need to, if possible, prevent a listing from appearing in the output of what shown if 'ps a' is run at the same time that the command in system() is running. Is there any way to do this in perl ?

Answer: How do I prevent the command/parameters in a system call from displaying in ps
contributed by comatose

No matter what, the command you are trying to run is going to show up in the process list. ps parses the /proc information and formats it nicely and will show everything running no matter what you might do in perl (assuming you don't use hacked versions of ps and top).

The only way to keep command arguments from showing is to use open() and pipe your arguments to it through STDIN. There might be some potential for obfuscation, but that's about it.

Please (register and) log in if you wish to add an answer



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (6)
    As of 2014-07-26 06:38 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (175 votes), past polls