You want to know for the latest N days who was able/unable to su, in solaris. Sulog is in /var/adm/sulog, and we don’t
have the niceties of GNU date, so we use perl inside a shell… “suentries.ksh”
#!/bin/ksh
#— n has how many days ago we want
n=$1
today=`/usr/bin/perl -e ‘printf “%dn”, time;’`
x=$n
while [ $x -gt -1 ];do
ago=$(($today-86400*${x}))
export ago
DAY=`perl -e ‘($a,$b,$c,$d,$e,$f,$g,$h,$i) =localtime($ENV{‘ago’});printf”%02d/%02dn”,$e+1,$d’`
echo “—- $DAY”
cat /var/adm/sulog | grep $DAY
x=$(($x-1))
done