#!/bin/bash
#
# Script sous Licence GPL
# François Boisson 29 Décembre 2003
# francois@boisson.homeip.net
# avec l'aide importante de la liste Debian-User-French
# dont notamment Loick B
# Une version bienaire de ce programme est en
# http://boisson.homeip.net/chercheprocess
# source http://boisson.homeip.net/chercheprocess.ml
# (écrit en camllight), paquet disponible sous
# deb ftp://boisson.homeip.net/woody ./
# 
cd /proc
y=1
echo -en "Test en cours...\t\t"
for i in `seq 1 65535`
do if (test -f $i/cmdline) || (test -e $i/task) ; then
if (test -f $i/cmdline) || (test -e $i/task) ; then
  case "$y" in
    1) echo -en "\b|";;
    2) echo -en "\b/";;
    3) echo -en "\b-";;
    4) echo -en "\b\\";;
    *) echo -en "\b-";;
  esac
  if [ "$y" -lt '5' ]; then let "y=$y+1"
  else y=0
  fi
 if test -z `ls | grep -w $i` ; then
    if test -z `ls */task 2> /dev/null | grep -w $i`; then
     echo 
     echo $i "pid caché"
     if test -f $i/task ; then
	cat $i/task/$i/cmdline
	echo -e "\nEnvironnement:\n"
	cat $i/task/$i/environ
	echo -e "\n----------"
	else
	cat $i/cmdline
	echo -e "\nEnvironnement:\n"
	cat $i/environ
	echo -e "\n----------"
     fi
     z=1
     fi
  fi
fi
fi
done
echo -e "\b \rTest terminé.    "
if [ "$z" ]; then echo "Des processus cachés ont été detectés."
else echo "Aucun processus caché n'a été détecté."
fi
exit 0


