SSH alert (RS232 display)
  1. #SSH login alert
  2. if [ -n "$SSH_CLIENT" ] && [ "$(echo $SSH_CLIENT |awk '{print $1}' |sed 's/./ /g' |awk '{print $1"."$2"."$3}')" != "foo.bar.zoo" ]
  3. then
  4. CLI=$(echo $SSH_CLIENT |awk '{print $1}')
  5. export DISPLAY=':0';
  6. echo "SSH session active $(date) from $CLI" >> $HOME/.ssh-login.log;
  7. echo "" >> $HOME/.ssh-login.log;
  8. kdialog --msgbox "SSH session active from $(echo $CLI)" --title "SSH Login Alert" & >/dev/null
  9. until (())
  10. do
  11. beep -l500 -f750
  12. sleep 0.05s
  13. beep -l500 -f1050
  14. sleep 0.05s
  15. #odeslani infa na RS232 displej pripojeny na ttyUSB0
  16. echo -e "xc" > /dev/ttyUSB0
  17. echo -e "$CLInSSH connection from" > /dev/ttyUSB0
  18. #konec RS232 displej
  19. done
  20. fi
Parsed in 0.007 seconds