wmii/rc/status

30 lines
603 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
PIDFILE=/tmp/ns.$USER.$DISPLAY/statuspid-$DISPLAY
2005-11-18 18:54:58 +03:00
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
# install signal handler for artificial sigexit:
fn sigint {
if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid)
rm -f $PIDFILE
2005-11-18 18:54:58 +03:00
exit
}
fn statustext {
# if you need a formatted date, use awk
2006-02-03 22:56:34 +03:00
echo `{date} `{uptime | sed 's/.*://; s/,//g'}
}
text=`{statustext}
while(xwrite /bar/3/data $"text) {
sleep 2
2005-12-22 23:18:09 +03:00
text=`{statustext}
2005-11-18 18:54:58 +03:00
}