2005-11-18 18:54:58 +03:00
|
|
|
#!9PREFIX/bin/rc
|
|
|
|
# periodically print date and load average to the bar
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
# install signal handler for artificial sigexit:
|
|
|
|
fn sigint {
|
|
|
|
if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid)
|
2006-02-08 19:34:13 +03:00
|
|
|
rm -f $PIDFILE
|
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
|
2006-02-03 22:56:34 +03:00
|
|
|
echo `{date} `{uptime | sed 's/.*://; s/,//g'}
|
2005-12-12 12:20:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
text=`{statustext}
|
2006-02-08 19:59:57 +03:00
|
|
|
while(xwrite /bar/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
|
|
|
}
|