Adminsys snippet

De ClissXXI.

  • récupérer la liste des fils d'un PID donné
#! /bin/sh

get_son()
{
    for FATHER in $@ ; do
        ps -o pid --no-header --ppid $FATHER
    done
}

get_all_son()
{
    GOON=1
    FATHER=$1
    while [ $GOON = 1 ] ; do
        echo $FATHER
        FATHER=`get_son $FATHER`
        [ -z "$FATHER" ] && GOON=0
    done
}

get_all_son $1

Outils personnels