5a3d713e379d8f22ee6e7ddb86a9c698d7a2da3f
brianlee
  Thu Mar 6 16:21:18 2025 -0800
Adding in Jim’s cdwSubmit backup code vs previous CIRM code

diff --git src/hg/cirm/cdw/cdwSubmit/cdwSubmit.c src/hg/cirm/cdw/cdwSubmit/cdwSubmit.c
index f59103b3ace..4ca4c0423b6 100644
--- src/hg/cirm/cdw/cdwSubmit/cdwSubmit.c
+++ src/hg/cirm/cdw/cdwSubmit/cdwSubmit.c
@@ -1075,34 +1075,37 @@
 
 /* Figure out directory ID for submission */
 int hostId = cdwGetHost(conn, "localhost");
 int submitDirId = cdwGetSubmitDir(conn, hostId, submitDir);
 
 if (justTest)
     return;
 
 /* Create a submission record */
 int submitId = makeNewEmptySubmitRecord(conn, submitUrl, user->id);
 
 /* Create a backup of the previous submission */
 if (!noBackup)
     {
     char cmd[PATH_LEN];
-    if (getenv("CIRM") == NULL) errAbort("Please set up your CIRM environment variable."); 
-    safef(cmd, sizeof(cmd), "cdwBackup %scdw/db.backups/cdwSubmit.%i", getenv("CIRM"), submitId -1);  
+    char *backupDir = cdwSetting(conn, "backup");
+    if (backupDir != NULL)
+	{
+	safef(cmd, sizeof(cmd), "cdwBackup %s/cdwSubmit.%i", backupDir, submitId -1);  
 	mustSystem(cmd); 
 	}
+    }
 
 /* Put our manifest and metadata files */
 char *access = tagFindLocalVal(tagStorm->forest, "access");
 if (access == NULL)
     access = "group";
 
 int manifestFileId= storeSubmissionFile(conn, manifestFile, submitId, submitDirId, user, access);
 int metaFileId= storeSubmissionFile(conn, metaFile, submitId, submitDirId, user, access);
 
 struct hash *metaIdHash = storeUsedMetaTags(conn, table, metaIx, tagStorm, metaHash);
 
 /* We'll make a loop through list figuring out which files are new and which are old.
  * We wrap errCatch block around these so that error message ends up in submission
  * record if there's a problem.  */
 struct submitFileRow *oldList = NULL, *newList = NULL;