CVS: theedge/bin lvu,1.39,1.40

Auke Kok sofar at lunar-linux.org
Mon Dec 22 17:31:26 GMT 2003


Update of /var/cvs/lunar/theedge/bin
In directory dbguin.lunar-linux.org:/tmp/cvs-serv2552

Modified Files:
	lvu 
Log Message:
Fixed up lvu voyeur... it works now again!!! (note it's a bit crude but quite effective at finding the right compile log file, it should work for everyone)


Index: lvu
===================================================================
RCS file: /var/cvs/lunar/theedge/bin/lvu,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- lvu	26 Nov 2003 20:52:12 -0000	1.39
+++ lvu	22 Dec 2003 17:31:24 -0000	1.40
@@ -347,10 +347,10 @@
 }
 
 
-find_lining()  {
-  for  FILE in $(ls  /var/lock/lining*  2>/dev/null);  do
-    if  ps  $(cat  $FILE  2>/dev/null)  |  grep  -q  lin;  then
-      echo  $FILE  |  sed  "s:/var/lock/lining.::"
+find_active_lin()  {
+  for FILE in $(ls /var/lock/installing.* 2>/dev/null) ; do
+    if [ -d /proc/$(cat $FILE) ] ; then
+      echo $FILE | sed "s:/var/lock/installing.::"
       return  0
     fi
   done
@@ -358,41 +358,32 @@
 }
 
 
-peak_lining()  {
-  if  [  -f     /var/lock/lining.$1   ]            &&
-      ps  $(cat  /var/lock/lining.$1  2>/dev/null)  |
-      grep  -q  lin                                &&
-      [  -f  /tmp/$1.compile.log  ]
-  then
-    nice  -n  +20                  \
-    tail  -f  /tmp/$1.compile.log  \
-          --follow=name            \
-          --pid=$(cat /var/lock/lining.$1)  2>/dev/null
+follow_active_lin()  {
+  if [ -f /var/lock/installing.$1 -a -d /proc/$(cat /var/lock/installing.$1) ] ; then
+    if  [ -f /tmp/lunar.lin.$(cat /var/lock/installing.$1).$1.compile-log.* ] ; then
+      tail -f /tmp/lunar.lin.$(cat /var/lock/installing.$1).$1.compile-log.* --follow=name --pid=$(cat /var/lock/installing.$1)  2>/dev/null
+    fi
   fi
 }
 
 
-activate_voyeur()  {
-  if  [  -n  "$1"  ]  &&
-      !  find_section  $1  >  /dev/null
-  then  ((  DEFAULT_DELAY  =  $1  *  60  ))
-        shift  1
+voyeur()  {
+  if [ -n "$1" ] && ! find_section $1 > /dev/null ; then
+    (( DEFAULT_DELAY = $1 * 60 ))
+    shift  1
   fi
 
-  for  MODULE  in  $@;  do
-    peak_lining  $MODULE
+  for MODULE in $@ ; do
+    follow_active_lin $MODULE
   done
 
   DEFAULT_DELAY=${DEFAULT_DELAY:=60}
 
-  while  true;  do
-    if    !  ACTIVE_MODULE=$(find_lining) ;  then
-      message  "${MESSAGE_COLOR}Waiting"       \
-               "${DEFAULT_DELAY}"              \
-               "seconds for a lin to begin."  \
-               "${DEFAULT_COLOR}"
-      for  ((  DELAY=DEFAULT_DELAY  ;  DELAY > 0  ;  DELAY--  )); do
-        if  ACTIVE_MODULE=$(find_lining);  then
+  while true ; do
+    if ! ACTIVE_MODULE=$(find_active_lin) ; then
+      message  "${MESSAGE_COLOR}Waiting ${DEFAULT_DELAY} seconds for a lin to begin.${DEFAULT_COLOR}"
+      for (( DELAY=DEFAULT_DELAY ; DELAY > 0 ; DELAY-- )); do
+        if ACTIVE_MODULE=$(find_active_lin) ; then
           break
         else
           sleep 1
@@ -400,9 +391,10 @@
       done
     fi
 
-    if    [  -z  "$ACTIVE_MODULE"  ];  
-    then  break
-    else  peak_lining  $ACTIVE_MODULE
+    if [ -z "$ACTIVE_MODULE" ] ; then
+      break
+    else
+      follow_active_lin $ACTIVE_MODULE
     fi
   done
 }
@@ -669,7 +661,7 @@
 
     voyeur)
       shift 1
-      activate_voyeur $@
+      voyeur $@
       ;;
 
     pam)




More information about the Lunar-commits mailing list