Skip to content

Instantly share code, notes, and snippets.

@cuibonobo
Created July 20, 2013 16:16
Show Gist options
  • Save cuibonobo/6045590 to your computer and use it in GitHub Desktop.
Save cuibonobo/6045590 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
mm=`date +%b`
dd=`date $1 +%d`
dd=`expr $dd`
if [ "$dd" -ge "10" ]
then
dt=`echo "$mm $dd"`
else
dt=`echo "$mm $dd"`
fi
cat /var/log/secure.log | grep -E '(Accepted|SUCCEEDED)'| grep "$dt" >> /tmp/access_granted
/usr/bin/mail -E -s "Access granted" email@myserver.com < /tmp/access_granted
rm /tmp/access_granted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment