wmii/extra/p9p/status
Georg Neis 215ac62fd7 move rc scripts to extra/p9p/, set shebang to /usr/local/plan9/bin/rc, remove 9PREFIX
don't expect anything to work, files are missing now
2006-02-25 19:12:09 +01:00

31 lines
660 B
Bash

#!/usr/local/plan9/bin/rc
# periodically print date and load average to the bar
PIDFILE=/tmp/ns.$USER.$DISPLAY/statuspid
if(test -r $PIDFILE) {
kill -2 `{cat $PIDFILE} >[2]/dev/null
}
if (~ $1 stop) exit
echo $pid >$PIDFILE
xwrite /bar/new/colors $WMII_NORMCOLORS
lab=`{wmiir read /bar|maxlab}
# install signal handler for artificial sigexit:
fn sigint {
if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid)
rm -f $PIDFILE
wmiir remove /bar/$lab
exit
}
fn statustext {
# if you need a formatted date, use awk
echo `{date} `{uptime | sed 's/.*://; s/,//g'}
}
while(text=`{statustext} xwrite /bar/$lab/data $"text){
sleep 2
}