Notifications using ssh and dbus-python

October 25, 2007

Submitted by: Taoufix

Category: Computers

160 views

  • First make sure dbus-python is installed on the remote host.
  • Download the mesg.sh script:
#!/bin/bash
 
if (($# < 2));then
    echo "Usage: ${0##*/} dest text [text ...]" > /dev/stderr
    exit 1
fi
dest=${1}
shift
 
ssh ${dest} "DISPLAY=:0 python" <
  • Make it executable:
$ mv mesg.sh.txt mesg.sh; chmod 755 mesg.sh
  • To send a message to a user at a remote desktop:
$ ./mesg.sh user@host "Are you ready for lunch ?"
  • You can also use html-like syntax to send URLs:
$ ./mesg.sh shikamaru@host '<a href="http://www.dattebayo.com/t/ns031.torrent">Naruto Shippuuden </a> is out'
  • He will receive the following notification:

If you liked this, please share it at your favorite sites:
  • Digg
  • Reddit
  • del.icio.us
  • Wikio
  • Facebook
  • Google
  • Technorati
  • TwitThis
  • MySpace
  • N4G
  • NewsVine
  • StumbleUpon
  • BlogMemes
  • Blogsvine
  • blogtercimlap
  • description
  • eKudos
  • Faves
  • Fleck
  • Scoopeo
  • Socialogs
  • Upnews
  • Yigg
  • E-mail this story to a friend!
  • Mixx

Leave a Reply

:D :) :cry: :( 8O :twisted: :!: :vangry: :XO: :up: ;) :mrgreen: :halo: :kiss: :roll: :? 8) :evil: :oops: :| :?: :x :$: more »