--- serverctl.new	2009-12-08 17:34:34.000000000 +0100
+++ serverctl	2009-12-15 18:30:58.000000000 +0100
@@ -612,12 +624,25 @@
   ;;
 #---------------------------------------------------------------------
   'status')
+    # Assumption: use the same user for start and checking status
     cqpid=`/bin/cat "$CQ_LOGDIR/cq.pid" 2>/dev/null`
     if ps -p $cqpid > /dev/null 2>&1 ; then
         echo "$CQ_TITLE is running."
+        # a little trick: we use the same mechanism as the java process to
+        # set our ulimit value, so ...
+        setUlimit
+	 # ... we print our own ulimit, which is the same as the java process
+	 echo "maximal number of open files: `ulimit -n`"
+        LSOF=`which lsof` 2>/dev/null
+        if [ -n $LSOF ]; then
+            OPENFILES=`$LSOF -p $cqpid | wc -l`
+            echo "number of open files:    $OPENFILES"
+        else
+            echo "(lsof command not found)"
+        fi
     else
         echo "$CQ_TITLE is stopped."
     fi
   ;;
 #---------------------------------------------------------------------
   *)

