Index: trunk/ippTools/src/pubtool.c
===================================================================
--- trunk/ippTools/src/pubtool.c	(revision 30376)
+++ trunk/ippTools/src/pubtool.c	(revision 30769)
@@ -37,4 +37,5 @@
 static bool addMode(pxConfig *config);
 static bool revertMode(pxConfig *config);
+static bool updaterunMode(pxConfig *config);
 
 # define MODECASE(caseName, func) \
@@ -63,4 +64,5 @@
         MODECASE(PUBTOOL_MODE_ADD, addMode);
         MODECASE(PUBTOOL_MODE_REVERT, revertMode);
+        MODECASE(PUBTOOL_MODE_UPDATERUN, updaterunMode);
       default:
         psAbort("invalid option (this should not happen)");
@@ -459,2 +461,40 @@
 }
 
+static bool updaterunMode(pxConfig *config)
+{
+    PS_ASSERT_PTR_NON_NULL(config, false);
+
+    psMetadata *where = psMetadataAlloc(); // WHERE conditions
+    PXOPT_COPY_S64(config->args, where, "-pub_id", "pub_id", "==");
+    PXOPT_COPY_S64(config->args, where, "-client_id", "client_id", "==");
+    PXOPT_COPY_STR(config->args, where, "-state", "state", "==");
+    PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
+    PXOPT_COPY_STR(config->args, where, "-fault", "fault", "==");
+
+    PXOPT_LOOKUP_STR(state, config->args, "-set_state",  true, false);
+
+    psString query = NULL;              // Query to run
+    psStringAppend(&query, "UPDATE publishRun LEFT JOIN publishDone using(pub_id) SET state = '%s'", state);
+
+    if (psListLength(where->list)) {
+        psString clause = psDBGenerateWhereConditionSQL(where, NULL);
+        psStringAppend(&query, "\n WHERE %s", clause);
+        psFree(clause);
+    } else {
+        psError(PS_ERR_UNKNOWN, false, "select arguments are required");
+        return false;
+    }
+    psFree(where);
+
+    if (!p_psDBRunQuery(config->dbh, query)) {
+        psError(PS_ERR_UNKNOWN, false, "Database error");
+        psFree(query);
+        return false;
+    }
+    psFree(query);
+
+    long numUpdated = psDBAffectedRows(config->dbh);
+    psLogMsg("pubtool", PS_LOG_INFO, "%ld rows updated.", numUpdated);
+
+    return true;
+}
