Announcement

Collapse
No announcement yet.

How To Use ps, kill, and nice to manage processes

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How To Use ps, kill, and nice to manage processes

    https://www.digitalocean.com/communi...esses-in-linux
    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
    – John F. Kennedy, February 26, 1962.

    #2
    An interesting article. However, I disagree with some of the recommendations regarding the "kill" command. (I've been fighting these bad ideas about how to correctly "kill" processes for a long time.) Namely, "kill -9" or "kill -KILL" should be the last option, not the second when trying to kill a process. I say this because SIGKILL is a signal that cannot be caught by a process and so it has no chance to clean up and die gracefully. This means that the process's data store might be corrupted or left in an unrecoverable state. Also, there's no guarantee that a SIGKILL sent to a process will make it die. Processes caught in a disk-wait state cannot be killed by any signal.

    Secondly, the HUP or HangUp signal has been re-purposed by service processes to restart or reread its configuration files. But, the original meaning of SIGHUP was that a modem connection was going down so a process (and a login session) should clean up and exit as soon as possible.

    I do use kill -9, but rarely. I use it only after trying "kill nnn", "kill -INT nnn", "kill -HUP nnn", and "kill -ABRT nnn". SIGABRT can be helpful in that it might cause the process to create a core image file so that debugging can happen.

    Of course, a misbehaving process might not die gracefully even using these steps. Nevertheless, it's my opinion that a savvy administrator would try the less drastic measures before using the "big gun" of kill -9.

    Sorry, this is one of my pet peeves that has surfaced after developing software for Unix/Linux over the last 3 decades.

    Comment


      #3
      Originally posted by andystmartin View Post
      ....

      I do use kill -9, but rarely. I use it only after trying "kill nnn", "kill -INT nnn", "kill -HUP nnn", and "kill -ABRT nnn". SIGABRT can be helpful in that it might cause the process to create a core image file so that debugging can happen.

      Of course, a misbehaving process might not die gracefully even using these steps. Nevertheless, it's my opinion that a savvy administrator would try the less drastic measures before using the "big gun" of kill -9.

      Sorry, this is one of my pet peeves that has surfaced after developing software for Unix/Linux over the last 3 decades.
      When I started using RH 5.0 in May of 1998 the ps command, and kill, was a useful tool. Over the years I've used it less and less and since moving to Kubuntu in 2009 I don't remember using it at all. What I have used on occasions is ksysguard's right mouse options, primarily to remove 3rd party daemons that have no purpose continue to run after you've quit their calling program. Teamviewer's daemon, teamviewerd, is a prime example. It is nothing less than a back door into your system. While I am running Teamviewer it serves a purpose, but not after I quite.
      "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
      – John F. Kennedy, February 26, 1962.

      Comment

      Working...
      X