Advertisement
Guest User

Untitled

a guest
Jul 25th, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.74 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. declare -A COWORKERS
  4. COWORKERS[charles]=1
  5. COWORKERS[thomas]=1
  6. COWORKERS[flavio]=1
  7. COWORKERS[michel]=1
  8. COWORKERS[david]=1
  9. COWORKERS[alexis]=1
  10. COWORKERS[igor]=1
  11.  
  12. RESPONSE=$(echo -e "HTTP/1.1 200 OK\n\nUser notified")
  13.  
  14. while [ 1 ]
  15. do
  16.         REQ=$(nc -i1 -l 29090 <<< "$RESPONSE")
  17.         RP=$(grep "^GET" <<< "$REQ")
  18.         USER=$(perl -pe 's|.*user=(.*?)&.*|\1|' <<< $RP)
  19.  
  20.         if [[ ${COWORKERS[$USER]} -ne 1 ]]; then
  21.                 continue
  22.         fi
  23.  
  24.         MSG=$(perl -pe 's|.*message=(.*?) HTTP.*$|\1|' <<< $RP)
  25.         qdbus org.kde.amarok /Player org.freedesktop.MediaPlayer.Pause 1>//dev/null
  26.         OUTPUT="$(date) [$USER] $MSG"
  27.         kdialog --passivepopup "$OUTPUT"
  28.         echo $OUTPUT
  29. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement