aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authoronefang2022-06-04 09:47:44 +1000
committeronefang2022-06-04 09:47:44 +1000
commit7738de6f011821e26d0e9b6a24caccaca8a300fe (patch)
tree6acd84f2c097237fc6f4f5595cc36542d75dd187
parentAdd my version of the Prosody mod_auth_custom_http module. (diff)
downloadopensim-SC-7738de6f011821e26d0e9b6a24caccaca8a300fe.zip
opensim-SC-7738de6f011821e26d0e9b6a24caccaca8a300fe.tar.gz
opensim-SC-7738de6f011821e26d0e9b6a24caccaca8a300fe.tar.bz2
opensim-SC-7738de6f011821e26d0e9b6a24caccaca8a300fe.tar.xz
Add a web option to sledjchisl, to start the web stuff.
-rw-r--r--src/sledjchisl/sledjchisl.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c
index 3a99afa..317d079 100644
--- a/src/sledjchisl/sledjchisl.c
+++ b/src/sledjchisl/sledjchisl.c
@@ -65,6 +65,8 @@ config SLEDJCHISL
65 stop "Welcome sim" 65 stop "Welcome sim"
66 Stop a sim, or everything. 66 Stop a sim, or everything.
67 -a when stopping everything will close down all tmux windows and panes. 67 -a when stopping everything will close down all tmux windows and panes.
68 web
69 Only start the web server part.
68 build 70 build
69 Rebuild everything. 71 Rebuild everything.
70 test 72 test
@@ -167,10 +169,11 @@ typedef enum
167 RESTART = 3, 169 RESTART = 3,
168 STATUS = 4, 170 STATUS = 4,
169 BUILD = 5, 171 BUILD = 5,
170 TEST = 6, 172 WEB = 6,
171 UNGITAR = 7, 173 TEST = 7,
172 UPDATE = 8, 174 UNGITAR = 8,
173 STOP = 9 175 UPDATE = 9,
176 STOP = 10
174} modes; 177} modes;
175 178
176modes currentMode = START; 179modes currentMode = START;
@@ -183,6 +186,7 @@ char *modeStrings[] =
183 "restart", 186 "restart",
184 "status", 187 "status",
185 "build", 188 "build",
189 "web",
186 "test", 190 "test",
187 "ungitAR", 191 "ungitAR",
188 "update", 192 "update",
@@ -2866,6 +2870,7 @@ byTab has the short name as the key, simData as the value.
2866 } 2870 }
2867 2871
2868 case BUILD : 2872 case BUILD :
2873 case WEB :
2869 { 2874 {
2870 // Done elsewhere. 2875 // Done elsewhere.
2871 break; 2876 break;
@@ -8594,6 +8599,8 @@ void sledjchisl_main(void)
8594 currentMode = STATUS; 8599 currentMode = STATUS;
8595 else if (strcmp(toys.optargs[0], "build") == 0) 8600 else if (strcmp(toys.optargs[0], "build") == 0)
8596 currentMode = BUILD; 8601 currentMode = BUILD;
8602 else if (strcmp(toys.optargs[0], "web") == 0)
8603 currentMode = WEB;
8597 else if (strcmp(toys.optargs[0], "test") == 0) 8604 else if (strcmp(toys.optargs[0], "test") == 0)
8598 currentMode = TEST; 8605 currentMode = TEST;
8599 else if (strcmp(toys.optargs[0], "ungitar") == 0) 8606 else if (strcmp(toys.optargs[0], "ungitar") == 0)
@@ -8888,7 +8895,7 @@ Copy correct config/config.ini to there.
8888 V("Not running inside the proper tmux server. %s == %s", eTMUX, toybuf); 8895 V("Not running inside the proper tmux server. %s == %s", eTMUX, toybuf);
8889 } 8896 }
8890 8897
8891 if (!isTmux) 8898 if ((!isTmux) && (WEB != currentMode))
8892 { // Let's see if the proper tmux server is even running. 8899 { // Let's see if the proper tmux server is even running.
8893 i = shellMe("%s %s/%s -q list-sessions 2>/dev/null | grep -q %s:", Tcmd, scRun, Tsocket, Tconsole); 8900 i = shellMe("%s %s/%s -q list-sessions 2>/dev/null | grep -q %s:", Tcmd, scRun, Tsocket, Tconsole);
8894 if (WIFEXITED(i)) 8901 if (WIFEXITED(i))
@@ -8928,7 +8935,7 @@ Copy correct config/config.ini to there.
8928 // Make the FCGI socket world read / write, coz we can't set it to group www-data, since -G only works for root, and we ain't root. 8935 // Make the FCGI socket world read / write, coz we can't set it to group www-data, since -G only works for root, and we ain't root.
8929 // TODO - BIG SECURITY HOLE??? 8936 // TODO - BIG SECURITY HOLE???
8930 "bash -c 'export PATH=%s:$PATH; printf \"\\033]0;FCGI web server\\007\"; sleep 2;" // The sleep is so that both are not creating the .shini files at the same time. 8937 "bash -c 'export PATH=%s:$PATH; printf \"\\033]0;FCGI web server\\007\"; sleep 2;" // The sleep is so that both are not creating the .shini files at the same time.
8931 "spawn-fcgi -n -u %s -s %s/%s -M 0666 -G www-data -- /usr/bin/valgrind --leak-check=full %s/current/bin/sledjchisl %s; " 8938 "/usr/bin/valgrind --leak-check=full %s/current/bin/sledjchisl web %s;"
8932 "cd %s; bash'" 8939 "cd %s; bash'"
8933 , 8940 ,
8934 pre, Tcmd, scRun, Tsocket, scBin, 8941 pre, Tcmd, scRun, Tsocket, scBin,
@@ -8938,7 +8945,7 @@ Copy correct config/config.ini to there.
8938 Tconsole, 8945 Tconsole,
8939 Tconsole, 8946 Tconsole,
8940 scBin, 8947 scBin,
8941 scUser, scRun, webSocket, scRoot, FLAG(v) ? "-v" : "", 8948 scRoot, FLAG(v) ? "-v" : "",
8942 scRoot 8949 scRoot
8943 ); 8950 );
8944 free(pre); 8951 free(pre);
@@ -8961,6 +8968,21 @@ Copy correct config/config.ini to there.
8961 E("tmux list-sessions command failed! %s", toybuf); 8968 E("tmux list-sessions command failed! %s", toybuf);
8962 } 8969 }
8963 8970
8971// TODO - doesn't solve the "rebuild sledjchisl, replace sledjchisl, restart web server" problem, coz there's still two sledjchisl running, the one that started the tmux, and the one running the tmux.
8972// But the simple solution of just running things in the background didn't help.
8973// So spend more time fixing all of that. Later. Need around tuit.
8974 if ((!isWeb) && (WEB == currentMode))
8975 {
8976 C("Spawning web server via spawn-fcgi");
8977 snprintf(toybuf, sizeof(toybuf),
8978 "spawn-fcgi -n -u %s -s %s/%s -M 0666 -G www-data -- /usr/bin/valgrind --leak-check=full %s/current/bin/sledjchisl %s",
8979 scUser, scRun, webSocket, scRoot, FLAG(v) ? "-v" : ""
8980 );
8981 if (shellMeFail(toybuf))
8982 E("spawn-fcgi command failed! %s", toybuf);
8983 goto finished;
8984 }
8985
8964 if ((!isWeb) && ((BUILD == currentMode) || (START == currentMode))) 8986 if ((!isWeb) && ((BUILD == currentMode) || (START == currentMode)))
8965 { 8987 {
8966//////////////////////////////////////////////////////////////////////////////////////////////////// 8988////////////////////////////////////////////////////////////////////////////////////////////////////