Inviare notifiche al desktop di Ubuntu da shell scripts

From RVM Wiki
Jump to navigation Jump to search
  • Si usa notify-send
  • Installare
sudo apt-get  install libnotify-bin
  • Testare:
notify-send 'title of notification' 'body of notification'
  • Attenzione: da shell script (esempio ifupdown), eseguito da root o in background, occorre gestire il Display e l'utente a cui notificare, tramite le apposite varibili, altrimenti la notifica non verrà mostrata:
DISPLAY=:0 XAUTHORITY=/home/myusername/.Xauthority /usr/bin/notify-send "Myscriptname" "Test of notification"

Riferimenti