diff options
author | onefang | 2021-08-19 21:23:43 +1000 |
---|---|---|
committer | onefang | 2021-08-19 21:23:43 +1000 |
commit | 550e010789bcd9d79a803df4cc2828922dad3838 (patch) | |
tree | 4de2565c726872dd40ed1658f6a4983568c69873 | |
parent | leak-- (diff) | |
download | opensim-SC-550e010789bcd9d79a803df4cc2828922dad3838.zip opensim-SC-550e010789bcd9d79a803df4cc2828922dad3838.tar.gz opensim-SC-550e010789bcd9d79a803df4cc2828922dad3838.tar.bz2 opensim-SC-550e010789bcd9d79a803df4cc2828922dad3838.tar.xz |
Add rsync and gitar stuff to sledjchisl backups.
-rw-r--r-- | src/sledjchisl/sledjchisl.c | 276 |
1 files changed, 255 insertions, 21 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index c2ec573..e4c4359 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c | |||
@@ -522,6 +522,8 @@ char *Tsocket = "opensim-tmux.socket"; | |||
522 | char *Ttab = "SC"; | 522 | char *Ttab = "SC"; |
523 | char *Tcmd = "tmux -S"; | 523 | char *Tcmd = "tmux -S"; |
524 | char *backupIARsim = "Sandbox"; | 524 | char *backupIARsim = "Sandbox"; |
525 | char *rSync = ""; | ||
526 | int rSyncPort = 0; | ||
525 | char *webRoot = "/var/www/html"; | 527 | char *webRoot = "/var/www/html"; |
526 | char *URL = "fcgi-bin/sledjchisl.fcgi"; | 528 | char *URL = "fcgi-bin/sledjchisl.fcgi"; |
527 | char *ToS = "Be good."; | 529 | char *ToS = "Be good."; |
@@ -1883,6 +1885,8 @@ void startSim(simData *simd, char *sim, char *type, int count, int window, int p | |||
1883 | snprintf(toybuf, sizeof(toybuf), "INITIALIZATION COMPLETE FOR %s", simd->name); | 1885 | snprintf(toybuf, sizeof(toybuf), "INITIALIZATION COMPLETE FOR %s", simd->name); |
1884 | waitTmuxText(simd->paneID, toybuf); | 1886 | waitTmuxText(simd->paneID, toybuf); |
1885 | I("%s is done starting up.", simd->name); | 1887 | I("%s is done starting up.", simd->name); |
1888 | sendTmuxCmd(simd->paneID, ""); | ||
1889 | sendTmuxCmd(simd->paneID, ""); | ||
1886 | ourSims->la = waitLoadAverage(ourSims->la, loadAverageInc, simTimeOut); | 1890 | ourSims->la = waitLoadAverage(ourSims->la, loadAverageInc, simTimeOut); |
1887 | if (1 < bulkSims) | 1891 | if (1 < bulkSims) |
1888 | bulkSims = bulkSims / 2; | 1892 | bulkSims = bulkSims / 2; |
@@ -1947,16 +1951,51 @@ void stopSim(simData *simd, char *sim, char *type, int count, int window, int pa | |||
1947 | } | 1951 | } |
1948 | } | 1952 | } |
1949 | 1953 | ||
1954 | typedef struct _ARList ARList; | ||
1955 | struct _ARList | ||
1956 | { | ||
1957 | int len, num; | ||
1958 | char **ARs, *this; | ||
1959 | }; | ||
1960 | |||
1961 | static int filterARs(struct dirtree *node) | ||
1962 | { | ||
1963 | if (!node->parent) return DIRTREE_RECURSE | DIRTREE_SHUTUP; | ||
1964 | ARList *list = (ARList *) node->parent->extra; | ||
1965 | int l0 = strlen(node->name), l1 = strlen(list->this); | ||
1966 | |||
1967 | // TODO - ignore zero sized ones. | ||
1968 | if ((4 < l0) && ((strncmp(&(node->name[l0 - 4]), ".iar", 4) == 0) || (strncmp(&(node->name[l0 - 4]), ".oar", 4) == 0)) && (strncmp(node->name, list->this, l1) == 0)) | ||
1969 | { | ||
1970 | if ((list->num + 1) > list->len) | ||
1971 | { | ||
1972 | list->len = list->len + 1; | ||
1973 | list->ARs = xrealloc(list->ARs, list->len * sizeof(char *)); | ||
1974 | } | ||
1975 | list->ARs[list->num] = xstrdup(node->name); | ||
1976 | list->num++; | ||
1977 | } | ||
1978 | return 0; | ||
1979 | } | ||
1980 | |||
1950 | // Forward declare this. | 1981 | // Forward declare this. |
1951 | my_ulonglong dbCount(char *table, char *where); | 1982 | my_ulonglong dbCount(char *table, char *where); |
1952 | void doSimsThing(simData *simd, char *sim, char *type, int count, int window, int panes, int pane) | 1983 | void doSimsThing(simData *simd, char *sim, char *type, int count, int window, int panes, int pane) |
1953 | { | 1984 | { |
1954 | // Check if only doing a single sim. | 1985 | // Check if only doing a single sim. |
1955 | int cont = FALSE; | 1986 | int cont = FALSE, member = false; |
1987 | char *last = strchr(sim, ' '); | ||
1956 | 1988 | ||
1957 | if (FLAG(m)) | 1989 | if (FLAG(m)) |
1958 | { | 1990 | { |
1959 | // TODO - check if it's a real user. | 1991 | // check if it's a real user. |
1992 | last[0] = '\0'; last++; | ||
1993 | // Double check it's a real member. | ||
1994 | snprintf(toybuf, sizeof(toybuf), "FirstName='%s' and LastName='%s'", sim, last); | ||
1995 | if (1 == dbCount("UserAccounts", toybuf)) | ||
1996 | member = TRUE; | ||
1997 | else | ||
1998 | E("Can't find member %s %s.", sim, last); | ||
1960 | } | 1999 | } |
1961 | else if (NULL != ourSims->target) | 2000 | else if (NULL != ourSims->target) |
1962 | { | 2001 | { |
@@ -1997,7 +2036,7 @@ byTab has the short name as the key, simData as the value. | |||
1997 | } | 2036 | } |
1998 | 2037 | ||
1999 | case BACKUP : // "backup -m 'onefang rejected'" "backup 'Welcome sim'" "backup Welcome.shini" "Welcome.shini backup" "backup Welcome.ini" "backup Welcome" "backup" backup everything | 2038 | case BACKUP : // "backup -m 'onefang rejected'" "backup 'Welcome sim'" "backup Welcome.shini" "Welcome.shini backup" "backup Welcome.ini" "backup Welcome" "backup" backup everything |
2000 | { // TODO - If it's not a sim code, and not a sim name, it's an account inventory. | 2039 | { |
2001 | struct timeval tv; | 2040 | struct timeval tv; |
2002 | time_t curtime; | 2041 | time_t curtime; |
2003 | char date[DATE_TIME_LEN]; | 2042 | char date[DATE_TIME_LEN]; |
@@ -2007,17 +2046,14 @@ byTab has the short name as the key, simData as the value. | |||
2007 | strftime(date, DATE_TIME_LEN, "%F_%T", localtime(&curtime)); | 2046 | strftime(date, DATE_TIME_LEN, "%F_%T", localtime(&curtime)); |
2008 | if (FLAG(m)) | 2047 | if (FLAG(m)) |
2009 | { | 2048 | { |
2010 | char *last = strchr(sim, ' '); | 2049 | if (member) |
2011 | |||
2012 | last[0] = '\0'; last++; | ||
2013 | // Double check it's a real member. | ||
2014 | snprintf(toybuf, sizeof(toybuf), "FirstName='%s' and LastName='%s'", sim, last); | ||
2015 | if (1 == dbCount("UserAccounts", toybuf)) | ||
2016 | { | 2050 | { |
2017 | I("Member %s %s is being backed up to %s/backups/%s_%s-%s.iar in tmux windo %s.", sim, last, scRoot, sim, last, date, ourSims->backup); | 2051 | I("Member %s %s is being backed up to %s/%s_%s-%s.iar in tmux windo %s.", sim, last, scBackup, sim, last, date, ourSims->backup); |
2018 | snprintf(toybuf, sizeof(toybuf), "save iar -c %s %s / password %s/backups/%s_%s-%s.iar", sim, last, scRoot, sim, last, date); | 2052 | snprintf(toybuf, sizeof(toybuf), "save iar -c %s %s / password %s/%s_%s-%s.iar", sim, last, scBackup, sim, last, date); |
2019 | if (NULL != ourSims->backup) | 2053 | if (NULL != ourSims->backup) |
2020 | { | 2054 | { |
2055 | if ('\0' == rSync[0]) | ||
2056 | shellMeFail("%s/current/bin/sledjchisl gitar -m %s %s %s", scRoot, FLAG(v) ? "-v" : "", sim, last); | ||
2021 | sendTmuxCmd(ourSims->backup, toybuf); | 2057 | sendTmuxCmd(ourSims->backup, toybuf); |
2022 | // if (0 == do) | 2058 | // if (0 == do) |
2023 | { | 2059 | { |
@@ -2026,16 +2062,18 @@ byTab has the short name as the key, simData as the value. | |||
2026 | I("%s %s is done backing up.", sim, last); | 2062 | I("%s %s is done backing up.", sim, last); |
2027 | sendTmuxCmd(ourSims->backup, ""); | 2063 | sendTmuxCmd(ourSims->backup, ""); |
2028 | sendTmuxCmd(ourSims->backup, ""); | 2064 | sendTmuxCmd(ourSims->backup, ""); |
2029 | // TODO - should delete / gitAR the old ones now. | 2065 | if ('\0' != rSync[0]) |
2030 | // Have a config option for delete / gitAR / rsync. | 2066 | { |
2067 | if (shellMeFail("time ionice -c3 nice -n 19 rsync -Ha -R --modify-window=2 --partial --port=%d --remove-source-files %s/*.iar %s", | ||
2068 | rSyncPort, scBackup, rSync)) | ||
2069 | E("rsync failed"); | ||
2070 | } | ||
2031 | ourSims->la = waitLoadAverage(ourSims->la, loadAverageInc, simTimeOut); | 2071 | ourSims->la = waitLoadAverage(ourSims->la, loadAverageInc, simTimeOut); |
2032 | } | 2072 | } |
2033 | } | 2073 | } |
2034 | else | 2074 | else |
2035 | E("Can't find backup sim."); | 2075 | E("Can't find backup sim."); |
2036 | } | 2076 | } |
2037 | else | ||
2038 | E("Can't find member %s %s.", sim, last); | ||
2039 | } | 2077 | } |
2040 | else if (checkSimIsRunning(simd->tab)) | 2078 | else if (checkSimIsRunning(simd->tab)) |
2041 | { | 2079 | { |
@@ -2044,15 +2082,23 @@ byTab has the short name as the key, simData as the value. | |||
2044 | // strip off the last bit of file name (YYYY-mm-dd_HH:MM:SS.oar) to get the name | 2082 | // strip off the last bit of file name (YYYY-mm-dd_HH:MM:SS.oar) to get the name |
2045 | // keep in mind some old files had munged names like "Tiffanie_s_Paradise-2021-06-23_05:11:38.oar" | 2083 | // keep in mind some old files had munged names like "Tiffanie_s_Paradise-2021-06-23_05:11:38.oar" |
2046 | I("Sim %s is being backed up to %s/backups/%s-%s.oar.", simd->name, scRoot, simd->tab, date); | 2084 | I("Sim %s is being backed up to %s/backups/%s-%s.oar.", simd->name, scRoot, simd->tab, date); |
2047 | snprintf(toybuf, sizeof(toybuf), "save oar --all %s/backups/%s-%s.oar", scRoot, simd->tab, date); | 2085 | if ('\0' == rSync[0]) |
2086 | shellMeFail("%s/current/bin/sledjchisl gitar %s %s", scRoot, FLAG(v) ? "-v" : "", simd->tab); | ||
2087 | snprintf(toybuf, sizeof(toybuf), "save oar --all %s/%s-%s.oar", scBackup, simd->tab, date); | ||
2048 | sendTmuxCmd(simd->paneID, toybuf); | 2088 | sendTmuxCmd(simd->paneID, toybuf); |
2049 | // if (0 == do) | 2089 | // if (0 == do) |
2050 | { | 2090 | { |
2051 | snprintf(toybuf, sizeof(toybuf), "Finished writing out OAR for %s", simd->name); | 2091 | snprintf(toybuf, sizeof(toybuf), "Finished writing out OAR for %s", simd->name); |
2052 | waitTmuxText(simd->paneID, toybuf); | 2092 | waitTmuxText(simd->paneID, toybuf); |
2053 | I("%s is done backing up.", simd->name); | 2093 | I("%s is done backing up.", simd->name); |
2054 | // TODO - should delete / gitAR the old ones now. | 2094 | sendTmuxCmd(simd->paneID, ""); |
2055 | // Have a config option for delete / gitAR / rsync. | 2095 | sendTmuxCmd(simd->paneID, ""); |
2096 | if ('\0' != rSync[0]) | ||
2097 | { | ||
2098 | if (shellMeFail("time ionice -c3 nice -n 19 rsync -Ha -R --modify-window=2 --partial --port=%d --remove-source-files %s/*.oar %s", | ||
2099 | rSyncPort, scBackup, rSync)) | ||
2100 | E("rsync failed"); | ||
2101 | } | ||
2056 | ourSims->la = waitLoadAverage(ourSims->la, loadAverageInc, simTimeOut); | 2102 | ourSims->la = waitLoadAverage(ourSims->la, loadAverageInc, simTimeOut); |
2057 | } | 2103 | } |
2058 | } | 2104 | } |
@@ -2061,6 +2107,189 @@ byTab has the short name as the key, simData as the value. | |||
2061 | 2107 | ||
2062 | case GITAR : // "gitAR -m avatar name" "gitAR sim name" | 2108 | case GITAR : // "gitAR -m avatar name" "gitAR sim name" |
2063 | { | 2109 | { |
2110 | /* Work around OpenSims slow database corruption bug by using git to store all old backups. | ||
2111 | Try to squeeze every last byte out of the tarballs. Seems to cut the total storage size down to one third the size of just the raw I/OAR files. | ||
2112 | Saves even more if there's been no changes. | ||
2113 | On the other hand, these backup files will grow indefinately, the more changes, the faster it grows. I can live with that for more reliable backups that go back further. | ||
2114 | Tries to avoid loosing data if things go wrong. I think the main remaining problem would be running out of space, in which case you have bigger problems to deal with. | ||
2115 | |||
2116 | Strategy - unpack the last one, unpack and commit any old I/OARs, pack up the result, delete it's working directory, THEN run the save i/oar. | ||
2117 | Avoids having to sync with OpenSim finishing the current I/OAR, and as a bonus, an easy to deliver latest I/OAR for people that want it. | ||
2118 | */ | ||
2119 | char *name = xstrdup(sim); | ||
2120 | |||
2121 | if (FLAG(m)) | ||
2122 | { | ||
2123 | if (member) | ||
2124 | { | ||
2125 | free(name); | ||
2126 | name = xmprintf("%s_%s", sim, last); | ||
2127 | } | ||
2128 | else | ||
2129 | { | ||
2130 | free(name); | ||
2131 | return; | ||
2132 | } | ||
2133 | } | ||
2134 | |||
2135 | char type = FLAG(m) ? 'I' : 'O'; | ||
2136 | char *gar = xmprintf("%s_git%cAR", name, type); | ||
2137 | char *gtr = xmprintf("%s/%s-git%cAR.tar.xz", scBackup, name, type); | ||
2138 | char *dir = xmprintf("%s/temp_backups%c_%s", scBackup, type, name); | ||
2139 | // Make sure stuff that's already compressed doesn't get compressed by git. | ||
2140 | // Also tries to protect binaries from mangling. | ||
2141 | char *gab = xmprintf("%s/%s/.gitattributes", dir, gar); | ||
2142 | char *ga = xmprintf("%s/%s", dir, gar); | ||
2143 | char *gal = xmprintf("%s/log", scBackup); | ||
2144 | char *gad = | ||
2145 | "*.bvh -delta -diff -text\n" | ||
2146 | "*.jp2 -delta -diff -text\n" | ||
2147 | "*.jpg -delta -diff -text\n" | ||
2148 | "*.llmesh -delta -diff -text\n" | ||
2149 | "*.ogg -delta -diff -text\n" | ||
2150 | "*.png -delta -diff -text\n" | ||
2151 | "*.r32 -delta -diff -text\n" | ||
2152 | "*.tga -delta -diff -text\n"; | ||
2153 | ARList *ourARs = xzalloc(sizeof(ARList)); | ||
2154 | |||
2155 | if (qfile_exist(dir)) | ||
2156 | { | ||
2157 | if (shellMeFail("echo 'Mess left over from last backup in %d, not gonna run!' >>%s/errors", dir)) | ||
2158 | E("Failed cleaning up the mess!"); | ||
2159 | if (shellMeFail("mv %s/*.%car %s 2>&1 >/dev/null", dir, tolower(type), scBackup)) | ||
2160 | E("Failed cleaning up the mess!"); | ||
2161 | goto gitARend; | ||
2162 | } | ||
2163 | |||
2164 | // Either unpack the old gitAR, or create a new one. | ||
2165 | qfile_mkdir(dir, S_IRWXU | S_IRGRP | S_IXGRP, true); | ||
2166 | if (qfile_exist(gtr)) | ||
2167 | { | ||
2168 | I("Unpacking %s", gtr); | ||
2169 | if (shellMeFail("cd %s; ionice -c3 nice -n 19 tar -xf %s", dir, gtr)) | ||
2170 | E("Failed to unpack %s!", gtr); | ||
2171 | } | ||
2172 | else | ||
2173 | { | ||
2174 | qfile_mkdir(gar, S_IRWXU | S_IRGRP | S_IXGRP, true); | ||
2175 | // git will create gar for us. | ||
2176 | if (shellMeFail("cd %s; git init %s >%s", dir, gar, gal)) | ||
2177 | E("Failed to git init %s/%s!", dir, gar); | ||
2178 | |||
2179 | // Coz git insists. | ||
2180 | if (shellMeFail("cd %s/%s; git config user.email \"opensim@$(hostname -A | cut -d ' ' -f 1)\"", dir, gar)) | ||
2181 | E("Failed to git config user.email!"); | ||
2182 | if (shellMeFail("cd %s/%s; git config user.name \"opensim\"", dir, gar)) | ||
2183 | E("Failed to git config user.name!"); | ||
2184 | |||
2185 | // Coz git insists on having something comitted before it can change the branch name. | ||
2186 | if (-1 == qfile_save(gab, gad, strlen(gad), false)) | ||
2187 | E("Faild to write %s file!", ga); | ||
2188 | if (shellMeFail("cd %s/%s; git add .gitattributes >>%s", dir, gar, gal)) | ||
2189 | E("Failed to git add!"); | ||
2190 | V("Committing initial git."); | ||
2191 | if (shellMeFail("cd %s/%s; git commit -qm \"Initial commit\" >>%s || echo \"ERROR - Could not commit!\" >>%s/errors ", | ||
2192 | dir, gar, gal, dir)) | ||
2193 | E("Failed to git commit!"); | ||
2194 | if (shellMeFail("cd %s/%s; git branch -m master Domme >>%s", dir, gar, gal)) | ||
2195 | E("Failed to git branch -m master Domme!"); | ||
2196 | } | ||
2197 | |||
2198 | // Git is such a pedantic bitch, let's just fucking ignore any errors it gives due to lack of anything to do. | ||
2199 | // Even worse the OpenSim devs breaking logout tracking gives git plenty of nothing to do. lol | ||
2200 | |||
2201 | // Loop through the .iar / .oar files in backups, ignoring zero sized files. | ||
2202 | struct dirtree *new = dirtree_add_node(0, scBackup, 0); | ||
2203 | int i; | ||
2204 | |||
2205 | ourARs->num = 0; | ||
2206 | ourARs->this = xmprintf("%s-", name); | ||
2207 | new->extra = (long) ourARs; | ||
2208 | dirtree_handle_callback(new, filterARs); | ||
2209 | qsort(ourARs->ARs, ourARs->num, sizeof(char *), qstrcmp); | ||
2210 | free(ga); | ||
2211 | ga = xmprintf("%s/errors", dir); | ||
2212 | for (i = 0; i < ourARs->num; i++) | ||
2213 | { | ||
2214 | I("Adding %s to %s", ourARs->ARs[i], gtr); | ||
2215 | // Deal with deletions in the inventory / sim, easy method, which becomes a nop for files that stay in the git add below. | ||
2216 | if (shellMeFail("cd %s/%s; rm -fr * >>%s", dir, gar, gal)) | ||
2217 | E("Failed to rm!"); | ||
2218 | if (shellMeFail("cd %s/%s; ionice -c3 nice -n 19 tar -xzf \"%s/%s\" || echo \"ERROR - Could not unpack %s !\" >>%s", | ||
2219 | dir, gar, scBackup, ourARs->ARs[i], ourARs->ARs[i], ga)) | ||
2220 | E("Failed to unpack %s!", ourARs->ARs[i]); | ||
2221 | if (!qfile_exist(ga)) | ||
2222 | { | ||
2223 | if (shellMeFail("cd %s/%s; git add * >>%s", dir, gar, gal)) | ||
2224 | E("Failed to git add!"); | ||
2225 | // The \\* bit is to escape the \ from snprintf, which itself escapes the * from the shell. | ||
2226 | if (shellMeFail("cd %s/%s; git add */\\* >>%s", dir, gar, gal)) | ||
2227 | E("Failed to git add!"); | ||
2228 | // Gotta add this again, coz of the rm. Apparently rm removes dotfiles, but add doesn't! | ||
2229 | if (-1 == qfile_save(gab, gad, strlen(gad), false)) | ||
2230 | E("Faild to write %s file!", ga); | ||
2231 | if (shellMeFail("cd %s/%s; git add .gitattributes >>%s", dir, gar, gal)) | ||
2232 | E("Failed to git add!"); | ||
2233 | |||
2234 | // Magic needed to figure out if there's anything to commit. | ||
2235 | // After all the pain to get this to work, there's an ever changing timestamp in archive.xml that screws it up. | ||
2236 | // Like this system didn't have enough timestamps in it already. lol | ||
2237 | // TODO - I could sed out that timestamp, and put it back again based on the OAR file name when extracting. | ||
2238 | // IARs don't seem to have the timestamp. | ||
2239 | int j = shellMe("cd %s/%s; t=$(git status --porcelain) && [ -z \"${t}\" ]", dir, gar); | ||
2240 | if (!WIFEXITED(j)) | ||
2241 | E("git status failed!"); | ||
2242 | else if (1 == WEXITSTATUS(j)) | ||
2243 | { | ||
2244 | V("Committing changes from %s", ourARs->ARs[i]); | ||
2245 | // Note this commit message has to be just the file name, as the ungitAR script uses it. | ||
2246 | if (shellMeFail("cd %s/%s; git commit -a -qm \"%s\" >>%s || echo \"ERROR - Could not commit %s !\" >>%s ", | ||
2247 | dir, gar, ourARs->ARs[i], ourARs->ARs[i], gal, ga)) | ||
2248 | E("Failed to git commit!"); | ||
2249 | if (qfile_exist(ga)) | ||
2250 | { | ||
2251 | free(ga); | ||
2252 | free(ourARs->ARs[i]); | ||
2253 | goto gitARend; | ||
2254 | } | ||
2255 | } | ||
2256 | else | ||
2257 | V("No changes to commit from %s.", ourARs->ARs[i]); | ||
2258 | } | ||
2259 | if (!qfile_exist(ga)) | ||
2260 | { | ||
2261 | if (shellMeFail("mv %s/%s %s", scBackup, ourARs->ARs[i], dir)) | ||
2262 | E("Failed to move %s!", ourARs->ARs[i]); | ||
2263 | } | ||
2264 | free(ourARs->ARs[i]); | ||
2265 | } | ||
2266 | |||
2267 | if (!qfile_exist(ga)) | ||
2268 | { | ||
2269 | I("Compressing gitAR %s", gtr); | ||
2270 | if (shellMeFail("cd %s; XZ_OPT='-9e' ionice -c3 nice -n 19 tar -c --xz %s -f %s || echo 'ERROR - Could not pack gitAR!' >>%s", | ||
2271 | dir, gar, gtr, ga)) | ||
2272 | E("Failed to git add!"); | ||
2273 | } | ||
2274 | gitARend: | ||
2275 | free(ga); | ||
2276 | ga = xmprintf("%s/errors", dir); | ||
2277 | if (qfile_exist(ga)) | ||
2278 | E("Failed to process the archives, look in %s for errors!", ga); | ||
2279 | else | ||
2280 | { | ||
2281 | if (shellMeFail("rm -fr %s", dir)) | ||
2282 | E("Failed to rm!"); | ||
2283 | } | ||
2284 | free(ga); | ||
2285 | free(ourARs->ARs); | ||
2286 | free(ourARs->this); | ||
2287 | free(ourARs); | ||
2288 | free(gab); | ||
2289 | free(dir); | ||
2290 | free(gtr); | ||
2291 | free(gar); | ||
2292 | free(name); | ||
2064 | break; | 2293 | break; |
2065 | } | 2294 | } |
2066 | 2295 | ||
@@ -7525,12 +7754,16 @@ void forEachMember(char *verb, simFunction func, simFunction not) | |||
7525 | { | 7754 | { |
7526 | char *file = xmprintf("%s/.lastTime", scBackup); | 7755 | char *file = xmprintf("%s/.lastTime", scBackup); |
7527 | 7756 | ||
7757 | free(last); | ||
7528 | last = (char *) qfile_load(file, NULL); | 7758 | last = (char *) qfile_load(file, NULL); |
7529 | if (NULL == last) | ||
7530 | last = xstrdup("0"); | ||
7531 | if (shellMeFail("date +%%s > %s", file)) | 7759 | if (shellMeFail("date +%%s > %s", file)) |
7532 | E("date command failed!"); | 7760 | E("date command failed!"); |
7533 | free(file); | 7761 | free(file); |
7762 | if ((NULL == last) || (NULL != ourSims->target)) | ||
7763 | { | ||
7764 | free(last); | ||
7765 | last = xstrdup("0"); | ||
7766 | } | ||
7534 | } | 7767 | } |
7535 | 7768 | ||
7536 | static dbRequest *users = NULL; | 7769 | static dbRequest *users = NULL; |
@@ -7552,7 +7785,6 @@ void forEachMember(char *verb, simFunction func, simFunction not) | |||
7552 | { | 7785 | { |
7553 | qhashtbl_t *row; | 7786 | qhashtbl_t *row; |
7554 | 7787 | ||
7555 | d("Number of rows returned %d", (int) rows->rows->size(rows->rows)); | ||
7556 | while (NULL != (row = rows->rows->getat(rows->rows, 0, NULL, true))) | 7788 | while (NULL != (row = rows->rows->getat(rows->rows, 0, NULL, true))) |
7557 | { | 7789 | { |
7558 | char *firstName = row->getstr(row, "FirstName", false); | 7790 | char *firstName = row->getstr(row, "FirstName", false); |
@@ -7862,6 +8094,8 @@ Other possibilities - | |||
7862 | if ((tmp = configs->getstr(configs, "Tsocket", false)) != NULL) {Tsocket = tmp; V("Setting Tsocket = %s", Tsocket);} | 8094 | if ((tmp = configs->getstr(configs, "Tsocket", false)) != NULL) {Tsocket = tmp; V("Setting Tsocket = %s", Tsocket);} |
7863 | if ((tmp = configs->getstr(configs, "Ttab", false)) != NULL) {Ttab = tmp; V("Setting Ttab = %s", Ttab);} | 8095 | if ((tmp = configs->getstr(configs, "Ttab", false)) != NULL) {Ttab = tmp; V("Setting Ttab = %s", Ttab);} |
7864 | if ((tmp = configs->getstr(configs, "backupIARsim", false)) != NULL) {backupIARsim = tmp; V("Setting backupIARsim = %s", backupIARsim);} | 8096 | if ((tmp = configs->getstr(configs, "backupIARsim", false)) != NULL) {backupIARsim = tmp; V("Setting backupIARsim = %s", backupIARsim);} |
8097 | if ((tmp = configs->getstr(configs, "rsync", false)) != NULL) {rSync = tmp; V("Setting rsync = %s", rSync);} | ||
8098 | if ((vd = configs->getstr(configs, "rsyncPort", false)) != NULL) {rSyncPort = (int) *((float *) vd); V("Setting rsyncPort = %s", rSyncPort);} | ||
7865 | if ((tmp = configs->getstr(configs, "webRoot", false)) != NULL) {webRoot = tmp; V("Setting webRoot = %s", webRoot);} | 8099 | if ((tmp = configs->getstr(configs, "webRoot", false)) != NULL) {webRoot = tmp; V("Setting webRoot = %s", webRoot);} |
7866 | if ((tmp = configs->getstr(configs, "URL", false)) != NULL) {URL = tmp; V("Setting URL = %s", URL);} | 8100 | if ((tmp = configs->getstr(configs, "URL", false)) != NULL) {URL = tmp; V("Setting URL = %s", URL);} |
7867 | if ((vd = configs->get (configs, "seshRenew", NULL, false)) != NULL) {seshRenew = (int) *((float *) vd); V("Setting seshRenew = %d", seshRenew);} | 8101 | if ((vd = configs->get (configs, "seshRenew", NULL, false)) != NULL) {seshRenew = (int) *((float *) vd); V("Setting seshRenew = %d", seshRenew);} |