diff options
author | onefang | 2022-03-18 21:17:58 +1000 |
---|---|---|
committer | onefang | 2022-03-18 21:17:58 +1000 |
commit | 2317c1b949e5dd753e7cc5c62c4b1ce7bffa5553 (patch) | |
tree | 990cab6317cbd41202fb8551e6c498c5b74c243c | |
parent | Abort gitar if we don't find the proper name inside. (diff) | |
download | opensim-SC-2317c1b949e5dd753e7cc5c62c4b1ce7bffa5553.zip opensim-SC-2317c1b949e5dd753e7cc5c62c4b1ce7bffa5553.tar.gz opensim-SC-2317c1b949e5dd753e7cc5c62c4b1ce7bffa5553.tar.bz2 opensim-SC-2317c1b949e5dd753e7cc5c62c4b1ce7bffa5553.tar.xz |
Less checks for membership and sim running, so we can deal with foreigners and not running sims.
-rw-r--r-- | src/sledjchisl/sledjchisl.c | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index c67187b..c659fb1 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c | |||
@@ -2316,16 +2316,8 @@ TODO - | |||
2316 | 2316 | ||
2317 | if (m) | 2317 | if (m) |
2318 | { | 2318 | { |
2319 | if (member) | 2319 | free(name); |
2320 | { | 2320 | name = xmprintf("%s_%s", sim, last); |
2321 | free(name); | ||
2322 | name = xmprintf("%s_%s", sim, last); | ||
2323 | } | ||
2324 | else | ||
2325 | { | ||
2326 | free(name); | ||
2327 | return; | ||
2328 | } | ||
2329 | } | 2321 | } |
2330 | 2322 | ||
2331 | char TYPE = m ? 'I' : 'O'; | 2323 | char TYPE = m ? 'I' : 'O'; |
@@ -2361,8 +2353,7 @@ TODO - | |||
2361 | 2353 | ||
2362 | if (m) | 2354 | if (m) |
2363 | { | 2355 | { |
2364 | if (member) | 2356 | fullName = qstrreplace("tn", name, " ", "_"); |
2365 | fullName = qstrreplace("tn", name, " ", "_"); | ||
2366 | } | 2357 | } |
2367 | if (NULL == fullName) | 2358 | if (NULL == fullName) |
2368 | fullName = qstrreplace("tn", simd->name, " ", "_"); | 2359 | fullName = qstrreplace("tn", simd->name, " ", "_"); |
@@ -2768,7 +2759,7 @@ byTab has the short name as the key, simData as the value. | |||
2768 | strftime(date, DATE_TIME_LEN, "%F_%T", localtime(&curtime)); | 2759 | strftime(date, DATE_TIME_LEN, "%F_%T", localtime(&curtime)); |
2769 | if (FLAG(m)) | 2760 | if (FLAG(m)) |
2770 | { | 2761 | { |
2771 | if (member) | 2762 | // if (member) |
2772 | { | 2763 | { |
2773 | I("Member %s %s is being backed up to %s/%s_%s-%s.iar in tmux window %s.", sim, last, scBackup, sim, last, date, ourSims->backup); | 2764 | I("Member %s %s is being backed up to %s/%s_%s-%s.iar in tmux window %s.", sim, last, scBackup, sim, last, date, ourSims->backup); |
2774 | snprintf(toybuf, sizeof(toybuf), "save iar %s %s / password %s/%s_%s-%s.iar -c -f=/Trash", sim, last, scBackup, sim, last, date); | 2765 | snprintf(toybuf, sizeof(toybuf), "save iar %s %s / password %s/%s_%s-%s.iar -c -f=/Trash", sim, last, scBackup, sim, last, date); |
@@ -2779,41 +2770,46 @@ byTab has the short name as the key, simData as the value. | |||
2779 | I("Running gitar on %s %s", sim, last); | 2770 | I("Running gitar on %s %s", sim, last); |
2780 | gitar(simd, sim, count, window, panes, pane, true, member, last); | 2771 | gitar(simd, sim, count, window, panes, pane, true, member, last); |
2781 | } | 2772 | } |
2782 | sendTmuxCmd(ourSims->backup, toybuf); | 2773 | if (member) |
2783 | // if (0 == do) | ||
2784 | { | 2774 | { |
2785 | snprintf(toybuf, sizeof(toybuf), "Saved archive with [[:digit:]]+ items for %s %s", sim, last); | 2775 | sendTmuxCmd(ourSims->backup, toybuf); |
2786 | waitTmuxText(ourSims->backup, toybuf); | 2776 | // if (0 == do) |
2787 | I("%s %s is done backing up.", sim, last); | ||
2788 | sendTmuxCmd(ourSims->backup, ""); | ||
2789 | sendTmuxCmd(ourSims->backup, ""); | ||
2790 | if ('\0' != rSync[0]) | ||
2791 | { | 2777 | { |
2792 | I("%s %s is rsyncing.", sim, last); | 2778 | snprintf(toybuf, sizeof(toybuf), "Saved archive with [[:digit:]]+ items for %s %s", sim, last); |
2793 | if (shellMeFail("ionice -c3 nice -n 19 rsync -Ha -R --modify-window=2 -P --port=%d --remove-source-files %s/*.iar %s", | 2779 | waitTmuxText(ourSims->backup, toybuf); |
2794 | rSyncPort, scBackup, rSync)) | 2780 | I("%s %s is done backing up.", sim, last); |
2795 | E("rsync failed"); | 2781 | sendTmuxCmd(ourSims->backup, ""); |
2796 | I("%s %s is done rsyncing.", sim, last); | 2782 | sendTmuxCmd(ourSims->backup, ""); |
2783 | if ('\0' != rSync[0]) | ||
2784 | { | ||
2785 | I("%s %s is rsyncing.", sim, last); | ||
2786 | if (shellMeFail("ionice -c3 nice -n 19 rsync -Ha -R --modify-window=2 -P --port=%d --remove-source-files %s/*.iar %s", | ||
2787 | rSyncPort, scBackup, rSync)) | ||
2788 | E("rsync failed"); | ||
2789 | I("%s %s is done rsyncing.", sim, last); | ||
2790 | } | ||
2797 | } | 2791 | } |
2798 | ourSims->la = waitLoadAverage(ourSims->la, loadAverageInc, simTimeOut); | ||
2799 | } | 2792 | } |
2793 | ourSims->la = waitLoadAverage(ourSims->la, loadAverageInc, simTimeOut); | ||
2800 | } | 2794 | } |
2801 | else | 2795 | else |
2802 | E("Can't find backup sim."); | 2796 | E("Can't find backup sim."); |
2803 | } | 2797 | } |
2804 | } | 2798 | } |
2805 | else if (checkSimIsRunning(simd->tab)) | 2799 | else // if (checkSimIsRunning(simd->tab)) |
2806 | { | 2800 | { |
2801 | bool running = checkSimIsRunning(simd->tab); | ||
2807 | I("Sim %s is being backed up to %s/backups/%s-%s.oar.", simd->name, scRoot, simd->tab, date); | 2802 | I("Sim %s is being backed up to %s/backups/%s-%s.oar.", simd->name, scRoot, simd->tab, date); |
2808 | if ('\0' == rSync[0]) | 2803 | if ('\0' == rSync[0]) |
2809 | { | 2804 | { |
2810 | I("Running gitar on %s", simd->tab); | 2805 | I("Running gitar on %s", simd->tab); |
2811 | gitar(simd, sim, count, window, panes, pane, false, member, last); | 2806 | gitar(simd, sim, count, window, panes, pane, false, member, last); |
2812 | } | 2807 | } |
2813 | snprintf(toybuf, sizeof(toybuf), "save oar --all %s/%s-%s.oar", scBackup, simd->tab, date); | 2808 | if (running) |
2814 | sendTmuxCmd(simd->paneID, toybuf); | ||
2815 | // if (0 == do) | ||
2816 | { | 2809 | { |
2810 | snprintf(toybuf, sizeof(toybuf), "save oar --all %s/%s-%s.oar", scBackup, simd->tab, date); | ||
2811 | sendTmuxCmd(simd->paneID, toybuf); | ||
2812 | // if (0 == do) | ||
2817 | snprintf(toybuf, sizeof(toybuf), "Finished writing out OAR for %s", simd->name); | 2813 | snprintf(toybuf, sizeof(toybuf), "Finished writing out OAR for %s", simd->name); |
2818 | waitTmuxText(simd->paneID, toybuf); | 2814 | waitTmuxText(simd->paneID, toybuf); |
2819 | I("%s is done backing up.", simd->name); | 2815 | I("%s is done backing up.", simd->name); |
@@ -2827,8 +2823,8 @@ byTab has the short name as the key, simData as the value. | |||
2827 | E("rsync failed"); | 2823 | E("rsync failed"); |
2828 | I("%s is done rsyncing.", simd->name); | 2824 | I("%s is done rsyncing.", simd->name); |
2829 | } | 2825 | } |
2830 | ourSims->la = waitLoadAverage(ourSims->la, loadAverageInc, simTimeOut); | ||
2831 | } | 2826 | } |
2827 | ourSims->la = waitLoadAverage(ourSims->la, loadAverageInc, simTimeOut); | ||
2832 | } | 2828 | } |
2833 | break; | 2829 | break; |
2834 | } | 2830 | } |
@@ -8359,6 +8355,13 @@ void forEachMember(char *verb, simFunction func, simFunction not) | |||
8359 | char *file = xmprintf("%s/.lastTime", scBackup); | 8355 | char *file = xmprintf("%s/.lastTime", scBackup); |
8360 | 8356 | ||
8361 | free(last); | 8357 | free(last); |
8358 | if (NULL != ourSims->target) | ||
8359 | { | ||
8360 | free(file); | ||
8361 | func(NULL, ourSims->target, "Member", 0, 0, 0, 0); | ||
8362 | return; | ||
8363 | } | ||
8364 | |||
8362 | last = (char *) qfile_load(file, NULL); | 8365 | last = (char *) qfile_load(file, NULL); |
8363 | if (shellMeFail("date +%%s > %s", file)) | 8366 | if (shellMeFail("date +%%s > %s", file)) |
8364 | E("date command failed!"); | 8367 | E("date command failed!"); |