notify-when-up2 is for letting you know when something changes.
Pop up a notification via libnotify
Display an X11 popup
Examples of things you might notify on include
A process dying - by pid or by name
A process exiting with a particular status - true or false
A program outputting a number less than or greater than a
Let you know when the output of a command changes
A tcp port starts listening
Pretty much anything you can write a shell command for that
converts what you're interested in to one of the above
$ notify-when-up2 --help
Usage: /usr/local/bin/notify-when-up2 --true-command cmd
-g|--greater-than fieldno cmd value
-G|--greater-than-or-equal-to fieldno cmd value
-l|--less-than fieldno cmd value
-L|--less-than-or-equal-to fieldno cmd value
-e|--equal-to fieldno cmd value
-n|--check-host-port host tcpport
Options are very order sensitive - EG, you need to specify
--remote-host before --pid, to make --pid operate on the correct
Also, you can specify more than one checking option on the same command.
/usr/local/bin/notify-when-up2 --pid 12345 --spawn-command "sleep 10" --pid 54321
Special (and optional) environment variables
NWUEMAIL The email address to send alerts to and from
NWUPAGE The email address to send pages to and from
NWUMAILACCOUNT The name of the account to which you wish to send e-mail
You can download it
If you want the --remote-host feature, you need to install
About the differences between notify-when-up and notify-when-up2
The options are subtly different between the two, but the general
idea is similar.
Specifically, options in notify-when-up2 are order
sensitive, while options in notify-when-up are not.
This means if you
give -m after -c, the -m won't impact the -c in notify-when-up2,
but it would've in notify-when-up.
notify-when-up2 lets you give multiple checking options in the
same run; notify-when-up did not. For example, with notify-when-up2
you can "notify-when-up2 -f false -t true", but in notify-when-up
you would've gotten an error doing this.
notify-when-up2 is a complete rewrite. notify-when-up grew without
planning; notify-when-up2 is much prettier inside.
notify-when-up2 adds the useful --remote-host option, that allows
you to check things on remote hosts, without requiring e-mail
or X11 to be feasible on remote hosts.
notify-when-up2 supports both GNU-style options like --true-command,
and older unix style options like -t. notify-when-up only
understands unix style options like -t.