Académique Documents
Professionnel Documents
Culture Documents
Syst TD6
Syst TD6
Département d’informatique
L2 ELI42 — Système
TD6
# ! /bin/sh # ! /bin/sh
# ! /bin/sh # ! /bin/sh
i=1 i=1
kill -TERM $$ kill -TERM $$
# ! /bin/sh
# ! /bin/sh
trap "echo toto" USR1
trap "echo toto ;exit 0" USR1
if [ "$1" = "" ]
if [ "$1" = "" ] then
then $0 15 &
$0 toto & $0 5 &
while true while true
do do
sleep 1 sleep 1
done done
fi fi
sleep 10 sleep $1
kill -USR1 $PPID kill -USR1 $PPID
kill -KILL $PPID
1
2 Écriture de script sur feuille
Question 1 : Écrire un script qui implémente un compteur par des signaux.
• SIGUSR1 sert à incrémenter ;
Question 2 : Quelles sont les commandes shell permettant d’envoyer chacun de ces signaux ?