Ubuntu Notifications using libnotify-bin

23 11 2008

Did you ever need to have one of your shell script notify you of something? Do you want to learn a quick way to do this in Ubuntu? Then read this.

I wrote a script that backs-up all my files to Amazon S3 using jets3t‘s synchronise tool. It works very well for me. Last week, my laptop got busted: I was upgrading to Ubuntu 8.10 and it overheated and shut down at a bad time (in the middle of the install). I couldn’t boot it after that. Luckily, I had backed up all my files to S3, so I was able to reinstall Ubuntu 8.10 from scratch and recover all my backed-up files. 3 hours later, I was up and running running Ubuntu 8.10 with all my files recovered.

However the point of this post is about notifications from a shell script. See, when I synchronise my files with S3 it takes some time and I would like to get alerted when everything is done backing up, so I needed a way to do that from my bash script.

Here is a quick way to do it on Ubuntu:

  1. Install libnotify-bin:
  2. sudo aptitude install libnotify-bin

  3. Learn how to use notify-send:
  4. notify-send --help

  5. In your scripts, just use it like this:
  6. notify-send 'title of notification' 'body of notification'

Your notification will now show up on your desktop like this:

notify-send

There you go, pretty simple, but very useful in your scripts.





Slides from my Ramaze Talk

20 11 2008

Over the last months, I have given this talk at the South Carolina Ruby Conference in Columbia SC, RubyConf in Orlando FL, and at the NovaRug in Reston VA.

You can find the code for the mini-blog that I wrote during the Live Coding part of the talk here.

I really enjoyed giving this talk and I hope that it got people excited about Ramaze.








Follow

Get every new post delivered to your Inbox.