Giter Club home page Giter Club logo

killparentpidtree's Introduction

killparentPIDtree

Script that kills all the childs of a parent PID

  1. run script with ./parent.sh &

  2. List processes ps -ef giohnny 11995 25 0 22:00 pts/0 00:00:00 -bash giohnny 11996 11995 0 22:00 pts/0 00:00:00 -bash giohnny 11997 11995 0 22:00 pts/0 00:00:00 -bash giohnny 11998 11995 0 22:00 pts/0 00:00:00 sleep infinity giohnny 11999 11996 0 22:00 pts/0 00:00:00 -bash giohnny 12000 11996 0 22:00 pts/0 00:00:00 sleep infinity giohnny 12001 11997 0 22:00 pts/0 00:00:00 sleep infinity giohnny 12002 11999 0 22:00 pts/0 00:00:00 sleep infinity

PID 11995 is the parent of 11996, 11997 and 11998 ----------- 1st itteration ----------- PID 11996 is the parent of 11999, 12000 PID 11997 is the parent of 12001 ----------- 2nd itteration ---------- PID 11999 is the parent of 12002 ----------- 3rd itteration ----------

  1. run ./killall 111995

OUTPUT pids= 11996 11997 11998 ==> 1st itteration PID[1] = 11996 pids= 11999 12000 ChCh_list = 11999 12000 PID[2] = 11997 pids= 12001 ChCh_list = 11999 12000 12001 ==> the list to scan for the second itteration PID[3] = 11998 pids= Final list = 11996 11997 11998 11999 12000 12001 PID[1] = 11999 pids= 12002 ChCh_list = 12002 ==> the list to scan for the 3rd itteration PID[2] = 12000 pids= PID[3] = 12001 pids= Final list = 11996 11997 11998 11999 12000 12001 12002 ==> final list to kill PID[1] = 12002 pids= Kill all 11996 11997 11998 11999 12000 12001 12002 + parent = 11995

killparentpidtree's People

Contributors

giohnny avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.