summaryrefslogtreecommitdiff
path: root/postpost/status
diff options
context:
space:
mode:
Diffstat (limited to 'postpost/status')
-rwxr-xr-xpostpost/status122
1 files changed, 122 insertions, 0 deletions
diff --git a/postpost/status b/postpost/status
new file mode 100755
index 0000000..dc84525
--- /dev/null
+++ b/postpost/status
@@ -0,0 +1,122 @@
+#!/bin/sh
+
+printsizes=false
+printload=false
+printnames=true
+for s in $*
+do
+ if [ $s = "-v" ] || [ $s = "--verbose" ]
+ then
+ printsizes=true;
+ printload=true;
+ fi
+ if [ $s = "-s" ] || [ $s = "--size" ]
+ then
+ printsizes=true;
+ fi
+ if [ $s = "-l" ] || [ $s = "--load" ]
+ then
+ printload=true;
+ fi
+ if [ $s = "-n" ] || [ $s = "--no-name" ]
+ then
+ printnames=false;
+ fi
+ if [ $s = "-h" ] || [ $s = "--help" ]
+ then
+ echo "Usage:"
+ echo "$0 directory [-s|-l|-h|-v]"
+ echo
+ echo "-v|--verbose print also directory-sizes and CPU-load"
+ echo "-s|--size print also directory-sizes"
+ echo "-l|--load print also CPU-load"
+ echo "-n|--no-name don't print names of lost processes"
+ echo "-h|--help print this help"
+ exit 0;
+ fi
+done
+
+Verz=`dirname $1`
+Name=`basename $1`
+
+finished=`find $1* -name times* | grep -c . `
+total=`ls -1 $Verz | grep -c $Name`
+running=`ps -A | grep -c lpic`
+queued=`grep -c "cd /home/simulation/lpic-1.3.1/lpic; ./lpic" ../../jobcontrol/todolist`
+
+if [ $total = 1 ]
+then
+ echo $finished of $total process correct finished
+else
+ echo $finished of $total processes correct finished
+fi
+
+if [ $running = 1 ]
+then
+ echo $running process still running
+else
+ echo $running processes still running
+fi
+
+if [ $queued = 1 ]
+then
+ echo $queued process queued
+else
+ echo $queued processes queued
+fi
+
+if [ $(($running + $finished + $queued - $total)) -ne 0 ]
+then
+ echo
+ echo "*********************************************************"
+ echo "* *"
+ echo "* There's at least one not correct finished process! *"
+ echo "* *"
+ echo "*********************************************************"
+ if $printnames
+ then
+ echo
+ echo "The bad guys are:"
+ for s in `ls -1 $Verz | grep $Name`
+ do
+ istokay=false
+ if [ "$(ls -1 "$Verz/$s" | grep -c "times")" = "1" ] || [ "$(ps -eo args | grep "\./lpic" | grep -v "grep" | awk '{ print "lpic/"$2; }' | awk '{ print "../"$1; }' | ./outputdir_of_inputfile | grep -c "$Verz/$s" )" = "1" ]
+ then
+ istokay=true
+ continue
+ fi
+ for t in $(grep "cd /home/simulation/lpic-1.3.1/lpic; ./lpic" ../../jobcontrol/todolist)
+ do
+ if [ -e "../lpic/$t" ] && [ ! "$t" = "./lpic" ]
+ then
+ if [ "$(echo "../lpic/$t" | ./outputdir_of_inputfile | grep -c "$Verz/$s")" = "1" ]
+ then
+ istokay=true
+ break
+ fi
+ fi
+ done
+ if ! $istokay
+ then
+ echo " "$Verz/$s" ... das ist "$(grep -l "$Verz/$s" ../lpic/input*);
+ fi
+ done
+ fi
+fi
+
+echo
+df -hP 2> /dev/null | grep "/home\$" | awk '{ print $3 " of " $2 " used (" $4 " free, " $ 5 " occupied)" }'
+echo
+if $printload
+then
+ ps -eo stime,time,pcpu,size,args | grep "\./lpic" | grep -v grep | awk '{ mem = int($4/1024); print "\"" $6 "\" since " $1 " (" $2 " time, " mem "MB used) " $3 "% load" }' | grep -v "(00:00:00 time,"
+ echo
+fi
+if $printsizes
+then
+ echo "Verzeichnisgrößen"
+ echo "-------------------"
+ du -hs $1*
+ echo
+fi
+