#!/bin/bash DAYS=${*:-0 days} DATE="$(date -d "$DAYS" '+%b %e')" [ -z "$DATE" ] && exit for site in $(/usr/local/bin/sitelookup -a domain) do file=/home/virtual/$site/var/log/wtmp host=$(echo $site | sed -e 's#.*/##') ENTRIES="$(last -f $file | fgrep "$DATE")" LENGTH=$(echo "$ENTRIES" | wc -c) if [ $LENGTH -gt 37 ] then echo "=====================================" echo $host echo "=====================================" echo "$ENTRIES" fi done | fgrep -v wtmp