d50114fc351ec339453a18e928fac8ad2c6cf859 hiram Thu Nov 1 13:23:24 2018 -0700 need to place the option on the list refs #22355 diff --git src/hg/dbTrash/dbTrash.c src/hg/dbTrash/dbTrash.c index ab56a29..6fbda66 100644 --- src/hg/dbTrash/dbTrash.c +++ src/hg/dbTrash/dbTrash.c @@ -38,43 +38,44 @@ " - file names in extFile are typically: \"../trash/ct/...\"\n" " -tableStatus - use 'show table status' to get size data, very inefficient\n" " -delLostTable - delete tables that exist but are missing from metaInfo\n" " - this operation can be even slower than -tableStatus\n" " - if there are many tables to check.\n" " -verbose=N - 2 == show arguments, dates, and dropped tables,\n" " - 3 == show date information for all tables." ); } static struct optionSpec options[] = { {"age", OPTION_FLOAT}, {"extFile", OPTION_BOOLEAN}, {"extDel", OPTION_BOOLEAN}, {"drop", OPTION_BOOLEAN}, + {"dropLimit", OPTION_INT}, {"db", OPTION_STRING}, {"topDir", OPTION_STRING}, {"tableStatus", OPTION_BOOLEAN}, {"delLostTables", OPTION_BOOLEAN}, {"historyToo", OPTION_BOOLEAN}, {NULL, 0}, }; static double ageHours = 0.0; /* must be specified */ static boolean drop = FALSE; /* optional */ +static int dropLimit = 0; /* optional */ static char *db = CUSTOM_TRASH; /* optional */ static boolean historyToo = FALSE; /* optional */ -static int dropLimit = 0; /* optional */ static time_t timeNow = 0; static time_t dropTime = 0; static boolean extFileCheck = FALSE; static boolean extDel = FALSE; static boolean tableStatus = FALSE; static boolean delLostTable = FALSE; static char *topDir = "/usr/local/apache/trash"; void checkExtFile(struct sqlConnection *conn) /* check extFile table for files that have been removed */ { char query[256]; struct sqlResult *sr; @@ -461,30 +462,31 @@ (unsigned long)ageSeconds); verbose(2,"# current time: %d-%02d-%02d %02d:%02d:%02d %ld\n", 1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, (unsigned long)timeNow); tm = localtime(&dropTime); verbose(2,"# drop time: %d-%02d-%02d %02d:%02d:%02d %ld\n", 1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, (unsigned long)dropTime); } else { verbose(1,"ERROR: specified age %.f must be greater than 0.0\n", ageHours); usage(); } drop = optionExists("drop"); +dropLimit = optionInt("dropLimit", 0); historyToo = optionExists("historyToo"); db = optionVal("db",db); extFileCheck = optionExists("extFile"); extDel = optionExists("extDel"); tableStatus = optionExists("tableStatus"); topDir = optionVal("topDir", topDir); verbose(2,"# drop requested: %s\n", drop ? "TRUE" : "FALSE"); if (0 == dropLimit) { verbose(2,"# drop limit: unlimited, drop all expired\n"); } else { verbose(2,"# drop limit: %d\n", dropLimit); } verbose(2,"# historyToo: %s\n", historyToo ? "TRUE" : "FALSE"); verbose(2,"# extFile: %s\n", extFileCheck ? "TRUE" : "FALSE");