Notify-Send Command in Linux


I have been using this notify-send for my own shell scripts so it alerts me on GUI about the system resources. Also, it has been very useful when I added the same onto my URL monitoring script which alerts as POP up whenever any server is unreachable.

Notify-send might already be there on your Linux system. If not, you can install the package “libnotify1″ (or possibly just “libnotify”) from your repositories.

Once installed, you can simply type the following, at the command line, to display a pop-up message near your system tray:

notify-send “How are you”

By default, the message displays for 5 seconds. You can change this by using “-t” switch. This will change, in milliseconds, how long the message is displayed. Enter “-t 0″ to leave the message up until the user closes it.

notify-send “This message will be displayed for 10 seconds” -t 10000

You can use the following code to just display a pop up of “system uptime” every 5 minutes

#!/bin/bash

while [ 1 ]; do
notify-send "Up Time" "`uptime`"
sleep 5m
done

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s