Registrieren  •  Login 
  
 
im Forum


 News   Online-Tools   Kontakt 


Pastebin
Dieser Code wurde am 01.10.2021, 13:56 von killerbees19 hochgeladen.

Direktlink zu diesem Code: https://www.happytec.at/pastebin/view.php?id=307

Bash
  1. #!/bin/bash
  2.  
  3. # Fritz!Box Call Notification
  4. # v1.0.1 (2021-10-01) by KB19
  5. # https://happytec.at/r/geaab
  6.  
  7. set -o pipefail
  8. interval=10
  9. timeout=300
  10. port=1012
  11.  
  12. if [[ "$1" == "" ]]
  13. then hostname="fritz.box"
  14. else hostname="$1"; fi
  15.  
  16. last=$(date +%s)
  17. while true
  18. do
  19. netcat -d -w "$timeout" "$hostname" "$port" | \
  20. awk -F ';' '
  21. {
  22. if($2 == "RING")
  23. {
  24. summary = "Eingehender Anruf bei deiner Fritz!Box.";
  25. body = sprintf("Genutzte Leitung: %s\nRufnummer: %s", $6, $5);
  26.  
  27. if($4 == "")
  28. {
  29. n="Unterdrückte Nummer"
  30. }
  31. else
  32. {
  33. n=$4
  34. }
  35.  
  36. body = body sprintf("\n\nAnrufer: %s", n);
  37. system("notify-send -u low -t 20000 -i /usr/local/share/icons/avm-fritz.png \"" summary "\" \"" body "\"");
  38. }
  39. }'
  40.  
  41. current=$(date +%s)
  42. [[ "$((current-last))" -lt "$interval" ]] && sleep "$interval"
  43. last=$current
  44. done
Dieser Code wurde in 0.0034 Sekunden mit GeSHi farblich hervorgehoben.

 

Verwendete Zeitzone: CET (Europe/Berlin)
Aktuelles Datum & Uhrzeit: 11.12.2023, 03:28
Nach oben
Valid HTML 4.01 Transitional
Valid CSS!

Hosted by netcup
 
 
[ happytec.at | blog.happytec.at | forum.happytec.at | esports.happytec.at ]