Results 1 to 4 of 4

Thread: ps -A and kill

  1. #1
    Good friend of the forums
    Join Date
    Jun 2008
    Posts
    425

    Default ps -A and kill

    Hi
    I've been trying to close a program with the kill command automated. I looked at the man pages, but it only say to enter a process id like 11025 to kill.
    I would like to grep httpd in ps and pipe that into kill.

    Thanks

  2. #2
    Senior Member streaker69's Avatar
    Join Date
    Jan 2010
    Location
    Virginville, BlueBall, Bird In Hand, Intercourse, Paradise, PA
    Posts
    3,535

    Default

    Quote Originally Posted by compaq View Post
    Hi
    I've been trying to close a program with the kill command automated. I looked at the man pages, but it only say to enter a process id like 11025 to kill.
    I would like to grep httpd in ps and pipe that into kill.

    Thanks
    Doesn't BT have the killall function? Then you could just name the process you want to kill instead of needing to look for the PID.
    A third party security audit is the IT equivalent of a colonoscopy. It's long, intrusive, very uncomfortable, and when it's done, you'll have seen things you really didn't want to see, and you'll never forget that you've had one.

  3. #3

    Default

    Quote Originally Posted by compaq View Post
    Hi
    I've been trying to close a program with the kill command automated. I looked at the man pages, but it only say to enter a process id like 11025 to kill.
    I would like to grep httpd in ps and pipe that into kill.

    Thanks
    Go with streaker's suggestion and use killall. If you really wanted to us ps, grep, awk and so forth, you normally could, however, httpd is a slightly different animal. It forks multiple instances and just killing the root owned httpd process won't kill all the children. If you are set on using ps, you could try to pipe the output into grep for httpd and if the result is true, use /etc/rc.d/rc.httpd to stop the process cleanly. You'd have to chmod rc.httpd first.

    Good luck...

  4. #4
    Good friend of the forums
    Join Date
    Jun 2008
    Posts
    425

    Default

    Thanks you two, its what i was after.

Posting Permissions

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