wmii/rc/status

35 lines
733 B
Plaintext
Raw Normal View History

2005-11-18 18:54:58 +03:00
#!9PREFIX/bin/rc
# periodically print date and load average to the bar
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 }
2005-11-18 18:54:58 +03:00
if(test -r $PIDFILE) {
kill -2 `{cat $PIDFILE} >[2]/dev/null
}
echo $pid >$PIDFILE
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
xwrite /ctl quit
2005-11-18 18:54:58 +03:00
exit
}
fn statustext {
# if you need a formatted date, use awk
echo (`{date} `{uptime | sed 's/.*://; s/,//g'})
}
text=`{statustext}
xwrite /new/data $"text
while(xwrite /1/data $"text) {
sleep 2
2005-12-22 23:18:09 +03:00
text=`{statustext}
2005-11-18 18:54:58 +03:00
}