rendered paste body[13:13:05]$ cat porter
#!/bin/bash
MAILTO="root"
HOSTNAME=`hostname`
VERDE="\[\033[01;32m\]"
NOCOR="\[\033[0m\]"
VERME="\[\033[01;31m\]"
getports() {
#lsof -i -n -P | awk '{ print $1 "\[\033[01;32m\]@\[\033[0m\]" $3 "\[\033[01;31m\]@\[\033[0m\]" $8 }' | sort -u
lsof -i -n -P | awk '{ print $1 " " $3 " " $8 }' | sort -u
}
VELHO="$(getports)"
echo -e "Comece com o seguinte arranjo de portas:\n$VELHO"
while sleep 10 ; do
NOVO="$(getports)"
if test "$VELHO" != "$NOVO" ; then
echo "\t\v Arranjo de portas alterado."
echo "Status antes da alteraçao:"
echo "$VELHO"
echo "Status depois da alteraçao:"
echo "$NOVO"
#EOF
fi
VELHO="$NOVO"
done