File: //var/opt/OV/bin/instrumentation/dormant-accounts-get.sh
#!/bin/bash
# Autor: Rossini, Hernan
# Sector: Operaciones, Datacenter, Av del Campo 1301, Artigas, Argentina.
# Fecha: 2016/05/10
# Minimo de dias.
DAYS_MIN=60
# Usuarios a excluir.
USERS_EXCLUDE='^abrt |^adm |^apache |^arpwatch |^avahi |^avahi-autoipd |^bin |^daemon |^dbus |^dovecot |^dovenull |^ftp |^games |^gdm |^gopher |^haldaemon |^halt |^hpsmh |^lp |^luci |^mail |^mailman |^mailnull |^netdump |^news |^nfsnobody |^nobody |^nscd |^ntp |^oms |^opc_op |^operator |^oprofile |^pcap |^postfix |^pulse |^ricci |^root |^rpc |^rpcuser |^rpm |^rtkit |^sabayon |^saslauth |^shutdown |^smmsp |^sshd |^stap-server |^sync |^tcpdump |^tss |^uucp |^uuidd |^vcsa |^xfs |^xguest'
# Obtengo la lista de dormant accounts.
lastlog --before $DAYS_MIN | grep -v 'Username.*Port.*From.*Latest' | grep -vE "$USERS_EXCLUDE" | sort