Skip to content

Instantly share code, notes, and snippets.

@vahit
Created August 14, 2017 04:27
Show Gist options
  • Save vahit/66bb61aabe16fb24d2e21b4a778426bd to your computer and use it in GitHub Desktop.
Save vahit/66bb61aabe16fb24d2e21b4a778426bd to your computer and use it in GitHub Desktop.
Take a photo with webcam if someone insert the wrong passwd -- For i3lock (you need fswebcam!)
echo " " > /tmp/i3lock_log.txt ##clear log
_date()
{
date=`grep 'pam_unix(i3lock:auth): authentication failure' /tmp/i3lock_log.txt | awk {'print $3'} | tail -n 1`
}
_date
pht="0"
while :
do
if pidof i3lock
then
journalctl -xn | tail -n 1 > /tmp/i3lock_log.txt
if ( grep 'pam_unix(i3lock:auth): authentication failure' /tmp/i3lock_log.txt )
then
if [[ $pht == "0" ]]
then
echo -e "$(fswebcam -c ~/.fswebcam.conf)" ##take a photo
pht="1"
fi
fi
else
notify-send "passwd wrong"
fi
sleep 3
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment