2005-11-18 18:54:58 +03:00
|
|
|
#!9PREFIX/bin/rc
|
|
|
|
# periodically print date and load average to the bar
|
|
|
|
|
2006-01-30 01:15:50 +03:00
|
|
|
WMIIR_ADDRESS='unix!/tmp/.ixp-'^$USER^'/wmiibar-'^$WMII_IDENT
|
2005-11-18 18:54:58 +03:00
|
|
|
PIDFILE=/tmp/.ixp-$USER/statuspid-$WMII_IDENT
|
|
|
|
|
2006-01-30 21:48:12 +03:00
|
|
|
fn xwrite { echo -n $2 | wmiir write $1 }
|
2006-01-30 01:15:50 +03:00
|
|
|
|
2005-11-18 18:54:58 +03:00
|
|
|
if(test -r $PIDFILE) {
|
|
|
|
kill -2 `{cat $PIDFILE} >[2]/dev/null
|
|
|
|
}
|
|
|
|
echo $pid >$PIDFILE
|
|
|
|
|
2006-01-30 01:15:50 +03:00
|
|
|
wmiibar -a $WMIIR_ADDRESS &
|
2005-11-18 18:54:58 +03:00
|
|
|
|
|
|
|
# install signal handler for artificial sigexit:
|
|
|
|
fn sigint {
|
|
|
|
if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid)
|
|
|
|
rm -f $PIDFILE
|
2006-01-30 01:15:50 +03:00
|
|
|
xwrite /ctl quit
|
2005-11-18 18:54:58 +03:00
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
2005-12-12 12:20:20 +03:00
|
|
|
fn statustext {
|
|
|
|
# if you need a formatted date, use awk
|
|
|
|
echo (`{date} `{uptime | sed 's/.*://; s/,//g'})
|
|
|
|
}
|
|
|
|
|
|
|
|
text=`{statustext}
|
2006-01-30 01:15:50 +03:00
|
|
|
xwrite /new/data $"text
|
|
|
|
while(xwrite /1/data $"text) {
|
2005-12-12 12:20:20 +03:00
|
|
|
sleep 2
|
2005-12-22 23:18:09 +03:00
|
|
|
text=`{statustext}
|
2005-11-18 18:54:58 +03:00
|
|
|
}
|