SHELL de UNIX a Linux
Publicado por santiman (2 intervenciones) el 03/01/2007 22:41:54
Hola!
No soy muy bueno en esto....he tenido problemas para correr un shell de unix en linux fedora...
este es el shell
#
# Shell que revisa constantemente si existen usuarios en el sistema
# que llevan mas de 20 min. sin utilizar su terminal.
# Estos usuarios son llevados al login, quedando un registro de ellos
# en un archivo de control llamado - MONITOREO -
#
#
#
who -u | egrep -v "root|oper001|prueba" | while true
do
read linea
if [ -n "$linea" ]
then
set $linea
usr=$1 tty=$2 tpo=$6
if [ "$tpo" != "." -a "$tty" != "console" -a "$tty" != "tty01" -a "$tty" != "ttya02" ]
then
if [ `echo $tpo | cut -d: -f2` -gt 20 -o `echo $tpo | cut -f1 -d:` -gt 0 ]
then
echo $tty
ps -t $tty | egrep "runcobol|pg" > /usr/tmp/control1
if [ -s /usr/tmp/control1 ]
then
echo
else
echo $tty
ps -t $tty
fuser -k /dev/$tty
fi
else
continue
fi
fi
else
exit
fi
done
No soy muy bueno en esto....he tenido problemas para correr un shell de unix en linux fedora...
este es el shell
#
# Shell que revisa constantemente si existen usuarios en el sistema
# que llevan mas de 20 min. sin utilizar su terminal.
# Estos usuarios son llevados al login, quedando un registro de ellos
# en un archivo de control llamado - MONITOREO -
#
#
#
who -u | egrep -v "root|oper001|prueba" | while true
do
read linea
if [ -n "$linea" ]
then
set $linea
usr=$1 tty=$2 tpo=$6
if [ "$tpo" != "." -a "$tty" != "console" -a "$tty" != "tty01" -a "$tty" != "ttya02" ]
then
if [ `echo $tpo | cut -d: -f2` -gt 20 -o `echo $tpo | cut -f1 -d:` -gt 0 ]
then
echo $tty
ps -t $tty | egrep "runcobol|pg" > /usr/tmp/control1
if [ -s /usr/tmp/control1 ]
then
echo
else
echo $tty
ps -t $tty
fuser -k /dev/$tty
fi
else
continue
fi
fi
else
exit
fi
done
Valora esta pregunta


0