Index: trunk/tools/eam/rawfix.20230221/src/check.rawfix.sh
===================================================================
--- trunk/tools/eam/rawfix.20230221/src/check.rawfix.sh	(revision 42399)
+++ trunk/tools/eam/rawfix.20230221/src/check.rawfix.sh	(revision 42400)
@@ -16,5 +16,26 @@
 set DBPASS = "dvo"
 
-set DBOPTS = "-B --skip-column-names -h $DBHOST -u $DBUSER -p$DBPASS $DBNAME"
+# set DBOPTS = "-B --skip-column-names -h $DBHOST -u $DBUSER -p$DBPASS $DBNAME"
+set DBOPTS = "-B -h $DBHOST -u $DBUSER -p$DBPASS $DBNAME"
+
+if ($mode == "all") then
+  if ($#argv != 1) then
+    echo "USAGE: check.rawfix.sh all"
+    exit 2
+  endif
+
+  mysql $DBOPTS -e "select dateobs, state from nights"
+  exit 0
+endif
+
+if ($mode == "stats") then
+  if ($#argv != 1) then
+    echo "USAGE: check.rawfix.sh stats"
+    exit 2
+  endif
+
+  mysql $DBOPTS -e "select count(dateobs) Nnights, state from nights group by state"
+  exit 0
+endif
 
 if ($mode == "night") then
@@ -29,6 +50,21 @@
 endif
 
-if ($mode == "new") then
-  mysql $DBOPTS -e "select dateobs from nights where (state = 'new')"
+if ($mode == "state") then
+  if ($#argv != 2) then
+    echo "USAGE: check.rawfix.sh state (state)"
+    exit 2
+  endif
+
+  set mystate = $2
+
+  if ($mystate == "new") goto good_state
+  if ($mystate == "rsync") goto good_state
+  if ($mystate == "md5sum.new") goto good_state
+
+  echo "ERROR: unknown mode $mystate"
+  exit 2
+
+  good_state:
+  mysql $DBOPTS -e "select dateobs from nights where (state = '$mystate')"
   exit 0
 endif
