diff options
Diffstat (limited to 'src/sledjchisl')
-rw-r--r-- | src/sledjchisl/sledjchisl.c | 78 |
1 files changed, 37 insertions, 41 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index 978bf33..8aad370 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c | |||
@@ -722,6 +722,7 @@ struct _simData | |||
722 | // portH is the HTTP port for the sim, portU is the UDP port for the sim. | 722 | // portH is the HTTP port for the sim, portU is the UDP port for the sim. |
723 | int locX, locY, sizeX, sizeY, sizeZ, portH, portU, maxPrims; | 723 | int locX, locY, sizeX, sizeY, sizeZ, portH, portU, maxPrims; |
724 | char *name, *tab, *UUID, *regionType, *estate, *owner; | 724 | char *name, *tab, *UUID, *regionType, *estate, *owner; |
725 | char *paneID; | ||
725 | int window, pane; | 726 | int window, pane; |
726 | }; | 727 | }; |
727 | 728 | ||
@@ -7668,10 +7669,6 @@ fcgiDone: | |||
7668 | { | 7669 | { |
7669 | // Join the session. | 7670 | // Join the session. |
7670 | doTmuxCmd("select-window -t '%s' \\; attach-session -t '%s'", Tconsole, Tconsole); | 7671 | doTmuxCmd("select-window -t '%s' \\; attach-session -t '%s'", Tconsole, Tconsole); |
7671 | // snprintf(toybuf, sizeof(toybuf), "%s %s/%s select-window -t '%s' \\; attach-session -t '%s'", Tcmd, scRun, Tsocket, Tconsole, Tconsole); | ||
7672 | // i = system(toybuf); | ||
7673 | // if (!WIFEXITED(i)) | ||
7674 | // E("tmux attach-session command failed! %s", toybuf); | ||
7675 | goto finished; | 7672 | goto finished; |
7676 | } | 7673 | } |
7677 | 7674 | ||
@@ -7692,7 +7689,7 @@ sims = -- Note these are .shini / tmux tab short names. | |||
7692 | { | 7689 | { |
7693 | int count = 0, window = 0, panes = 4, pane = 0; | 7690 | int count = 0, window = 0, panes = 4, pane = 0; |
7694 | 7691 | ||
7695 | I("Loading configuration file - %s", toybuf); | 7692 | I("Loading sims file - %s", toybuf); |
7696 | status = luaL_loadfile(L, toybuf); | 7693 | status = luaL_loadfile(L, toybuf); |
7697 | if (status) // If something went wrong, error message is at the top of the stack. | 7694 | if (status) // If something went wrong, error message is at the top of the stack. |
7698 | E("Couldn't load file: %s", lua_tostring(L, -1)); | 7695 | E("Couldn't load file: %s", lua_tostring(L, -1)); |
@@ -7789,6 +7786,7 @@ sims = -- Note these are .shini / tmux tab short names. | |||
7789 | { | 7786 | { |
7790 | char *path = xmprintf("%s/%s.shini", scEtc, nm); | 7787 | char *path = xmprintf("%s/%s.shini", scEtc, nm); |
7791 | char *newPath = xmprintf("%s/sim%d/%s.ini", scTemp, count, nm); // Coz OpenSim. | 7788 | char *newPath = xmprintf("%s/sim%d/%s.ini", scTemp, count, nm); // Coz OpenSim. |
7789 | char *cmd; | ||
7792 | 7790 | ||
7793 | if (0 == panes) | 7791 | if (0 == panes) |
7794 | doTmuxCmd("split-window -hp 50 -d -t '%s:0.1'", Tconsole); | 7792 | doTmuxCmd("split-window -hp 50 -d -t '%s:0.1'", Tconsole); |
@@ -7810,39 +7808,41 @@ sims = -- Note these are .shini / tmux tab short names. | |||
7810 | doTmuxCmd("split-window -hp 50 -d -t '%s:%d.0'", Tconsole, window); | 7808 | doTmuxCmd("split-window -hp 50 -d -t '%s:%d.0'", Tconsole, window); |
7811 | } | 7809 | } |
7812 | /* TODO - | 7810 | /* TODO - |
7813 | tmux -S /opt/opensim_SC-DG/var/run/opensim-tmux.socket list-panes -t 31 -F '#{pane_index} #{pane_id}' | 7811 | IDs={ |
7814 | 0 %39 | 7812 | ['21 0'] = '@17.%65', |
7815 | 1 %42 | 7813 | ['21 1'] = '@17.%68', |
7816 | 2 %40 | 7814 | ['21 2'] = '@17.%66', |
7817 | 3 %41 | 7815 | ['21 3'] = '@17.%67', |
7816 | } | ||
7817 | return IDs | ||
7818 | 7818 | ||
7819 | I can get the tabs to show their ID. session:window.pane $sessionID $=ExactSessionMatch @windowID @=ExactWindowMatch %paneID | 7819 | Move window and pane opening to ROBUST starting time. |
7820 | "The pane ID is passed to the child process of the pane in the TMUX_PANE environment variable." | 7820 | So the writing of the pane ID files is also then. |
7821 | Tuck the window and pane ID into the tmp ini file we are about to make, so other runs of sledjchisl can find it. | 7821 | Open those pane ID files also before the main loop. |
7822 | So all the actions have access. | ||
7822 | 7823 | ||
7823 | Leave empty panes as is. | 7824 | Leave empty panes as is. |
7824 | Don't bother to close panes unless we are doing a full stop. | 7825 | Don't bother to close panes unless we are doing a full stop. |
7825 | 7826 | Also clear out tmp when doing afull stop. | |
7826 | Is there a "switch to pane 1" command? Nope | ||
7827 | Ctrc A digit Move to that numbered window. | ||
7828 | Ctrl A arrow key Move to the pane in that direction. | ||
7829 | Ctrl A n Move to the next window. | ||
7830 | Ctrl A p Move to the previous window. | ||
7831 | Ctrl A w Choose the current window interactively. | ||
7832 | Ctrl A o Move to the next pane. | ||
7833 | Ctrl A ; Move to the previously selected pane. | ||
7834 | Ctrl A l Move to the previously selected window. | ||
7835 | Ctrl A Ctrl o Rotate panes"forwards". I do this accidently sometimes, coz MC. | ||
7836 | Ctrl A Alt o Rotate panes"backwards". | ||
7837 | Ctrl A z Toggle zooming into the current pane. | ||
7838 | */ | 7827 | */ |
7839 | } | 7828 | } |
7840 | I("%s is starting up in tab [%d:%s] pane .%d, from %s/sim%d.", name, window, type, pane, scTemp, count); | 7829 | snprintf(toybuf, sizeof(toybuf), "echo 'IDs={' >%s/IDs_%d.lua", scTemp, window); |
7841 | 7830 | system(toybuf); | |
7842 | char *cmd = xmprintf("rm -fr %s/sim%d; mkdir -p %s/sim%d; sed -E" | 7831 | doTmuxCmd("list-panes -t %d -F \"['%d #{pane_index}'] = '#{window_id}.#{pane_id}',\" >> %s/IDs_%d.lua", window, window, scTemp, window); |
7832 | snprintf(toybuf, sizeof(toybuf), "echo '}\nreturn IDs' >>%s/IDs_%d.lua", scTemp, window); | ||
7833 | system(toybuf); | ||
7834 | |||
7835 | snprintf(toybuf, sizeof(toybuf), "%s/IDs_%d.lua", scTemp, window); | ||
7836 | qtreetbl_t *IDs = Lua2tree(toybuf, "IDs"); | ||
7837 | snprintf(toybuf, sizeof(toybuf), "%d %d", window, pane); | ||
7838 | simd->paneID = qLuaGet(IDs, toybuf)->v.s; | ||
7839 | |||
7840 | I("%s is starting up in tab [%d:%s](pane %d), tmux ID = %s, from %s/sim%d.", name, window, type, pane, simd->paneID, scTemp, count); | ||
7843 | simd->portH = 8004 + count * 2; | 7841 | simd->portH = 8004 + count * 2; |
7844 | simd->portU = 8005 + count * 2; | 7842 | simd->portU = 8005 + count * 2; |
7843 | cmd = xmprintf("rm -fr %s/sim%d; mkdir -p %s/sim%d; sed -E" | ||
7845 | " -e 's@\\[Region\\]@" | 7844 | " -e 's@\\[Region\\]@" |
7845 | " paneID = \"\\%s\"\\n" | ||
7846 | "\\[Startup\\]\\n" | 7846 | "\\[Startup\\]\\n" |
7847 | " PIDFile = \"\\$\\{Paths\\|CachePath\\}\\/\\$\\{Const\\|mysim\\}\\.pid\"\\n" | 7847 | " PIDFile = \"\\$\\{Paths\\|CachePath\\}\\/\\$\\{Const\\|mysim\\}\\.pid\"\\n" |
7848 | " LogFile = \"\\$\\{Paths\\|LogPath\\}\\/OpenSim_\\$\\{Const\\|mysim\\}\\.log\"\\n" | 7848 | " LogFile = \"\\$\\{Paths\\|LogPath\\}\\/OpenSim_\\$\\{Const\\|mysim\\}\\.log\"\\n" |
@@ -7856,6 +7856,7 @@ Is there a "switch to pane 1" command? Nope | |||
7856 | " %s >%s", | 7856 | " %s >%s", |
7857 | scTemp, count, | 7857 | scTemp, count, |
7858 | scTemp, count, | 7858 | scTemp, count, |
7859 | simd->paneID, | ||
7859 | simd->portU, | 7860 | simd->portU, |
7860 | simd->portU, | 7861 | simd->portU, |
7861 | simd->portH, | 7862 | simd->portH, |
@@ -7869,22 +7870,20 @@ Is there a "switch to pane 1" command? Nope | |||
7869 | E("sed command failed!"); | 7870 | E("sed command failed!"); |
7870 | free(cmd); | 7871 | free(cmd); |
7871 | 7872 | ||
7872 | cmd = xmprintf("%d.%d", simd->window, simd->pane); | 7873 | doTmuxCmd("select-pane -t %s:%s -T '%s'", Tconsole, simd->paneID, nm); |
7873 | doTmuxCmd("select-pane -t %s:%s -T '%s'", Tconsole, cmd, nm); | ||
7874 | { | 7874 | { |
7875 | snprintf(toybuf, sizeof(toybuf), "mono OpenSim.exe -inidirectory=%s/sim%d", scTemp, count); | 7875 | snprintf(toybuf, sizeof(toybuf), "mono OpenSim.exe -inidirectory=%s/sim%d", scTemp, count); |
7876 | sendTmuxCmd(cmd, toybuf); | 7876 | sendTmuxCmd(simd->paneID, toybuf); |
7877 | if (0 == doWait) | 7877 | if (0 == doWait) |
7878 | { | 7878 | { |
7879 | snprintf(toybuf, sizeof(toybuf), "INITIALIZATION COMPLETE FOR %s", name); | 7879 | snprintf(toybuf, sizeof(toybuf), "INITIALIZATION COMPLETE FOR %s", name); |
7880 | waitTmuxText(cmd, toybuf); | 7880 | waitTmuxText(simd->paneID, toybuf); |
7881 | I("%s is done starting up.", name); | 7881 | I("%s is done starting up.", name); |
7882 | la = waitLoadAverage(la, loadAverageInc, simTimeOut); | 7882 | la = waitLoadAverage(la, loadAverageInc, simTimeOut); |
7883 | } | 7883 | } |
7884 | count++; | 7884 | count++; |
7885 | doWait = (count % bulkSims); | 7885 | doWait = (count % bulkSims); |
7886 | } | 7886 | } |
7887 | free(cmd); | ||
7888 | free(newPath); | 7887 | free(newPath); |
7889 | free(path); | 7888 | free(path); |
7890 | } | 7889 | } |
@@ -7974,14 +7973,11 @@ Is there a "switch to pane 1" command? Nope | |||
7974 | } | 7973 | } |
7975 | } | 7974 | } |
7976 | nextSim: | 7975 | nextSim: |
7977 | // if (panes) | 7976 | pane++; |
7977 | if (pane >= panes) | ||
7978 | { | 7978 | { |
7979 | pane++; | 7979 | pane = 0; |
7980 | if (pane >= panes) | 7980 | window++; |
7981 | { | ||
7982 | pane = 0; | ||
7983 | window++; | ||
7984 | } | ||
7985 | } | 7981 | } |
7986 | //if (4 < number) break; | 7982 | //if (4 < number) break; |
7987 | } | 7983 | } |