SMF service notification "applet"

A very quick and dirty "applet" to run to be notified of SMF services that are in maintenance.

Put the following in you path somewhere and then add that to the list of things GNOME starts for you at login: System->Preferences->Startup Applications

#!/bin/ksh

while [ true ] ; do
	message="$(svcs -H -o fmri,state -s state | \\
		awk '$2 ~/maintenance/ {printf("%s\\nState: %s", $1, $2)}')"

	notify-send -i remove -u critical "$message" > /dev/null 2>&1
	sleep 1m
done

Comments:

There should be a way to do this without polling, think of your battery!

Posted by Chris Gerhard on December 02, 2009 at 04:57 AM GMT #

Agreed, but I did say quick and dirty! Also I wrote this for my desktop so my battery is the national grid :-) Apparently there is a real solution to have a desktop FMA applet which will get SMF events too.

Posted by Darren Moffat on December 02, 2009 at 06:18 AM GMT #

I wonder if ctwatch(1) could do this more elegantly...hate being on deadline when interesting questions come up!

Posted by Michael Ernest on December 02, 2009 at 10:20 AM GMT #

that 'sleep 1m' fails here. With ksh, or ksh93.

Posted by Sean on December 02, 2009 at 11:09 AM GMT #

ctwatch requires privs that I don't by default have but more importantly did not spot when I marked nwam as in maintenance.

A slightly lower impact would be to run the test in a trap hadler waiting on THAW. Sleep 1m after getting THAW and then check. I know on my laptop that would be good enough.

@Sean you need /usr/gnu/bin early in your path for sleep 1m to work.

Posted by Chris Gerhard on December 03, 2009 at 12:54 AM GMT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

DarrenMoffat

Search

Categories
Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today