Skip to content
Newer
Older
100644 453 lines (372 sloc) 10.4 KB
38fb85e @klacke ""
authored Apr 30, 2002
1 %%%----------------------------------------------------------------------
2 %%% File : yaws_ctl.erl
3 %%% Author : Claes Wikstrom <klacke@bluetail.com>
4 %%% Purpose :
5 %%% Created : 29 Apr 2002 by Claes Wikstrom <klacke@bluetail.com>
6 %%%----------------------------------------------------------------------
7
8
9 %% some code to remoteley control a running yaws server
10
11 -module(yaws_ctl).
12 -author('klacke@bluetail.com').
13
14 -compile(export_all).
15 -include_lib("kernel/include/file.hrl").
6cf3ece @klacke ""
authored Nov 20, 2005
16 -include("../include/yaws.hrl").
17 -include("../include/yaws_api.hrl").
28e4c73 @klacke first attempt to run properly under cygwin
authored Sep 8, 2003
18 -include("yaws_debug.hrl").
2f51c68 @klacke -check arg
authored Nov 20, 2002
19
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
20
21
22 %% assumes the appropriate file structures
23 %% are already created with the right perms
24
6dc4cca @klacke ""
authored May 25, 2004
25 start(_GC, FirstTime) when FirstTime == false ->
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
26 ok;
27 start(GC, true) ->
28 case proc_lib:start_link(?MODULE, run, [GC]) of
29 ok ->
30 ok;
31 {error, RSN} ->
32 error_logger:format("~s~n",[RSN]),
a16f95e @klacke erlang:faultify
authored Feb 14, 2005
33 erlang:fault(RSN)
28e4c73 @klacke first attempt to run properly under cygwin
authored Sep 8, 2003
34 end.
35
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
36
37 run(GC) ->
38 %% First check if there is already a Yaws system running
39 %% with the same sid.
40
41 case connect(GC#gconf.id) of
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
42 {ok, Sock, _Key} ->
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
43
44 %% Not good, let's get some sys info
45 %% from that system so we can produce a good error
46 %% message
47 gen_tcp:close(Sock),
48 e("There is already a yaws system running with the same ~n"
49 " id <~p> on this computer, ~n"
50 " set another id in the yaws conf file ~n",
51 [GC#gconf.id]);
52 {error, eaccess} ->
53 %% We're not allowed to open the ctl file
54 e("Error reading ~s, you are probably (sometimes) running ~n"
55 " yaws as another userid, but with the same yaws id <~p> ~n"
56 " set another id in the yaws conf file ~n",
57 [ctl_file(GC#gconf.id), GC#gconf.id]);
58 {error, _} ->
59 %% Fine, this should be the case
60 run_listen(GC)
61 end.
62
63
64 ctl_args() ->
65 [{packet, 2},
66 {active, false},
67 binary,
68 {ip, {127,0,0,1}},
69 {reuseaddr, true}].
70
71 run_listen(GC) ->
72 case gen_tcp:listen(0, ctl_args()) of
38fb85e @klacke ""
authored Apr 30, 2002
73 {ok, L} ->
74 case inet:sockname(L) of
75 {ok, {_, Port}} ->
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
76 {A1, A2, A3}=now(),
77 random:seed(A1, A2, A3),
78 Key = random:uniform(1 bsl 64),
79 case w_ctl_file(GC#gconf.id, Port, Key) of
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
80 ok ->
81 proc_lib:init_ack(ok),
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
82 aloop(L, GC, Key);
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
83 error ->
c9778e0 @klacke added support for 2 additional configure
authored Apr 27, 2006
84 error_logger:format(
85 "Failed to create/manipulate the ctlfile ~n"
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
86 "called ~s~n"
c9778e0 @klacke added support for 2 additional configure
authored Apr 27, 2006
87 "Either problems with permissions or "
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
88 " earlier runs of yaws ~nwith the same id "
c9778e0 @klacke added support for 2 additional configure
authored Apr 27, 2006
89 " <~p> as this, check dir for perms~n"
90 "None of Yaws ctl functions will work~n",
91 [ctl_file(GC#gconf.id), GC#gconf.id]),
92 proc_lib:init_ack(ok),
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
93 aloop(L, GC, Key)
94 end;
0c9da97 @klacke added ability to run as different user than root
authored Nov 27, 2002
95 Err ->
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
96 e("Cannot get sockname for ctlsock: ~p",[Err] )
38fb85e @klacke ""
authored Apr 30, 2002
97 end;
0c9da97 @klacke added ability to run as different user than root
authored Nov 27, 2002
98 Err ->
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
99 e("Cannot listen on ctl socket, fatal: ~p", [Err])
100 end.
101
0c9da97 @klacke added ability to run as different user than root
authored Nov 27, 2002
102
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
103 e(Fmt, Args) ->
104 proc_lib:init_ack({error, io_lib:format(Fmt, Args)}),
105 exit(normal).
106
107
108
109 %% write the control file, set perms of the file
110 %% so that only this user can read the file
111 %% That way we're making sure different users
112 %% cannot manipulate eachothers webservers
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
113 w_ctl_file(Sid, Port, Key) ->
114 case catch
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
115 begin
116 F = ctl_file(Sid),
117 ?Debug("Ctlfile : ~s~n", [F]),
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
118 file:write_file(F, io_lib:format("~w.", [{Port,Key}])),
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
119 {ok, FI} = file:read_file_info(F),
120 ok = file:write_file_info(F, FI#file_info{mode = 8#00600})
121 end of
122 {'EXIT', _} ->
123 error;
124 _ ->
125 ok
38fb85e @klacke ""
authored Apr 30, 2002
126 end.
127
128
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
129 ctl_file(Sid) ->
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored May 30, 2006
130 FN = filename:join([yaws_generated:ctldir(), "ctl-" ++ yaws:to_list(Sid)]),
131 filelib:ensure_dir(FN),
132 FN.
c9778e0 @klacke added support for 2 additional configure
authored Apr 27, 2006
133
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
134
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
135 aloop(L, GC, Key) ->
38fb85e @klacke ""
authored Apr 30, 2002
136 case gen_tcp:accept(L) of
137 {ok, A} ->
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
138 handle_a(A, GC, Key);
42adffd @klacke *** empty log message ***
authored Feb 21, 2006
139 Err ->
140 error_logger:format("yaws_ctl failed to accept: ~p~n",
141 [Err]),
142 timer:sleep(2000),
38fb85e @klacke ""
authored Apr 30, 2002
143 ignore
144 end,
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
145 ?MODULE:aloop(L, GC, Key).
38fb85e @klacke ""
authored Apr 30, 2002
146
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
147 handle_a(A, GC, Key) ->
38fb85e @klacke ""
authored Apr 30, 2002
148 case gen_tcp:recv(A, 0) of
149 {ok, Data} ->
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
150 case catch binary_to_term(Data) of
151 {hup, Key} ->
50a7ab2 @klacke added support/docs for embedded mode
authored Sep 27, 2002
152 Res = yaws:dohup(A),
153 Res;
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
154 {stop, Key} ->
3e843b6 @klacke rewrote yaws SSL code to use the packet http and packet line modes th…
authored Aug 15, 2005
155 gen_tcp:send(A, io_lib:format(
156 "stopping yaws with id=~p\n",
157 [GC#gconf.id])),
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
158 file:delete(ctl_file(GC#gconf.id)),
38fb85e @klacke ""
authored Apr 30, 2002
159 init:stop();
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
160 {{trace, What}, Key} ->
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
161 Res = actl_trace(What),
162 gen_tcp:send(A, Res),
163 gen_tcp:close(A);
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
164 {status, Key} ->
50a7ab2 @klacke added support/docs for embedded mode
authored Sep 27, 2002
165 a_status(A),
166 gen_tcp:close(A);
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
167 {{load, Mods}, Key} ->
caa1a72 @carsten3347 Added command `-load' to yaws script.
carsten3347 authored Jul 16, 2003
168 a_load(A, Mods),
169 gen_tcp:close(A);
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
170 {id, Key} ->
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
171 a_id(A),
172 gen_tcp:close(A);
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
173 {Other, Key} ->
50a7ab2 @klacke added support/docs for embedded mode
authored Sep 27, 2002
174 gen_tcp:send(A, io_lib:format("Other: ~p~n", [Other])),
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
175 gen_tcp:close(A);
176 _Other ->
50a7ab2 @klacke added support/docs for embedded mode
authored Sep 27, 2002
177 gen_tcp:close(A)
178
179 end;
70510de @klacke file descriptor leak bug found by Mats Cronqvist where each call to '…
authored Feb 22, 2006
180 {error, _} ->
181 gen_tcp:close(A);
2129adc @klacke ""
authored May 30, 2002
182 _Err ->
38fb85e @klacke ""
authored Apr 30, 2002
183 ignore
184 end.
185
6377222 @klacke ""
authored Jun 16, 2002
186
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
187 %% We implement this by reloading a patched config
188 actl_trace(What) ->
189 case lists:member(What, [traffic, http, off]) of
190 true ->
191 {ok, GC, SCs} = yaws_api:getconf(),
192 case GC#gconf.trace of
193 false when What /= off->
194 yaws_api:setconf(GC#gconf{trace = {true, What}},SCs),
195 io_lib:format(
196 "Turning on trace of ~p to file ~s~n",
197 [What,
198 filename:join([GC#gconf.logdir,
199 "trace." ++ atom_to_list(What)])]);
200 false when What == off ->
201 io_lib:format("Tracing is already turned off ~n",[]);
202 {true, _} when What == off ->
203 yaws_api:setconf(GC#gconf{trace = false},SCs),
204 "Turning trace off \n";
205 {true, What} ->
206 io_lib:format("Trace of ~p is already turned on, ose 'off' "
207 "to turn off~n", [What]);
3445992 @klacke Bug in yaws_api:request_url/1 with explicit portnums in URLs found by…
authored May 27, 2004
208 {true, _Other} ->
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
209 yaws_api:setconf(GC#gconf{trace = {true, What}},SCs),
210 io_lib:format(
211 "Turning on trace of ~p to file ~s~n",
212 [What,
213 filename:join([GC#gconf.logdir,
214 "trace." ++ atom_to_list(What)])])
215 end;
216 false ->
217 "Need either http | traffic | off as argument\n"
218 end.
219
220
6377222 @klacke ""
authored Jun 16, 2002
221
222 f(Fmt, As) ->
223 io_lib:format(Fmt, As).
224
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
225
226 a_id(Sock) ->
227 ID = gen_server:call(yaws_server, id, []),
228 gen_tcp:send(Sock, ID),
229 ok.
230
231
6377222 @klacke ""
authored Jun 16, 2002
232 a_status(Sock) ->
233 {UpTime, L} = yaws_server:stats(),
a7ac905 @klacke introduced opaque data in sconf
authored Oct 16, 2002
234 {Days, {Hours, Minutes, _Secs}} = UpTime,
6377222 @klacke ""
authored Jun 16, 2002
235 H = f("~n Uptime: ~w Days, ~w Hours, ~w Minutes ~n",
236 [Days, Hours, Minutes]),
237
238 T =lists:map(
239 fun({Host,IP,Hits}) ->
240 L1= f("stats for ~p at ~p ~n",
241 [Host,IP]),
242 T = "\n"
243 "URL Number of hits\n",
244 L2=lists:map(
245 fun({Url, Hits2}) ->
246 f("~-30s ~-7w ~n",
247 [Url, Hits2])
248 end, Hits),
249 END = "\n",
250 [L1, T, L2, END]
251 end, L),
8722844 @klacke a file which has at least one compilation error shouldn't be cached i…
authored Sep 17, 2002
252 gen_tcp:send(Sock, [H, T]),
253
254 %% Now lets' figure out the status of loaded modules
255 ok.
6377222 @klacke ""
authored Jun 16, 2002
256
caa1a72 @carsten3347 Added command `-load' to yaws script.
carsten3347 authored Jul 16, 2003
257 a_load(A, Mods) ->
258 case purge(Mods) of
259 ok ->
260 gen_tcp:send(A, f("~p~n", [loadm(Mods)]));
261 Err ->
262 gen_tcp:send(A, f("~p~n", [Err]))
263 end.
264
265 loadm([]) ->
266 [];
267 loadm([M|Ms]) ->
268 [code:load_file(M)|loadm(Ms)].
269
270 purge(Ms) ->
271 case purge(Ms, []) of
272 [] -> ok;
273 L -> {cannot_purge, L}
274 end.
275
276 purge([], Ack) ->
277 Ack;
278 purge([M|Ms], Ack) ->
279 case code:soft_purge(M) of
280 true ->
281 purge(Ms, Ack);
282 false ->
283 purge(Ms, [M|Ack])
284 end.
285
286
3dc56a7 @klacke javascript support in ehtml
authored Sep 12, 2002
287
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
288 connect(Sid) ->
289 connect_file(ctl_file(Sid)).
290
291
292 %% The ctl file contains the port number the yaws server
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
293 %% is listening at and secret key string.
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
294
295 connect_file(CtlFile) ->
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
296 case file:consult(CtlFile) of
297 {ok, [{Port, Key}]} ->
298 case gen_tcp:connect({127,0,0,1}, Port,
299 [{active, false},
300 {reuseaddr, true},
301 binary,
302 {packet, 2}], 2000) of
303 {ok, Socket} ->
304 {ok, Socket, Key};
305 Err ->
306 Err
307 end;
38fb85e @klacke ""
authored Apr 30, 2002
308 Err ->
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
309 Err
310 end.
311
312
313
314 actl(SID, Term) ->
315 case connect(SID) of
316 {error, eaccess} ->
317 io:format("Another user is using the yaws sid <~p>, ~n"
318 "You are not allowd to read the file <~s>, ~n"
319 "specify by <-I id> which yaws system you want "
320 " to control~n",
321 [SID, ctl_file(SID)]);
322 {error, econnrefused} ->
323 io:format("No yaws system responds~n",[]);
324 {error, Reason} ->
325 io:format("You failed to read the ctlfile ~s~n"
326 "error was: <~p>~n"
327 "specify by <-I id> which yaws system you want "
328 " to control~n",
329 [ctl_file(SID), Reason]);
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
330 {ok, Socket, Key} ->
331 Str = s_cmd(Socket, SID, Key, Term),
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
332 io:format("~s", [Str])
38fb85e @klacke ""
authored Apr 30, 2002
333 end,
334 init:stop().
335
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
336
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
337 s_cmd(Fd, SID, Key, Term) ->
338 gen_tcp:send(Fd, term_to_binary({Term, Key})),
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
339 Res = case gen_tcp:recv(Fd, 0) of
340 {ok, Bin} ->
341 binary_to_list(Bin);
342 Err ->
343 io_lib:format("yaws server for yaws id <~p> not "
344 "responding: ~p ~n", [SID, Err])
345 end,
346 gen_tcp:close(Fd),
347 Res.
3dc56a7 @klacke javascript support in ehtml
authored Sep 12, 2002
348
38fb85e @klacke ""
authored Apr 30, 2002
349
d659ba3 @klacke added a 'yaws -ls' command that lists all yaws servers on localhost
authored May 26, 2004
350 %% List existing yaws nodes on this machine
351 ls(_) ->
c9778e0 @klacke added support for 2 additional configure
authored Apr 27, 2006
352 case file:list_dir(yaws_generated:ctldir()) of
6dc4cca @klacke ""
authored May 25, 2004
353 {ok, List} ->
d659ba3 @klacke added a 'yaws -ls' command that lists all yaws servers on localhost
authored May 26, 2004
354 io:format("~-15s~-10s~-10s~n",
355 ["Id", "Status", "Owner"]),
356 io:format("-------------------------------------~n",[]),
6dc4cca @klacke ""
authored May 25, 2004
357 lists:foreach(
c9778e0 @klacke added support for 2 additional configure
authored Apr 27, 2006
358 fun(CtlFile) ->
359 lls(CtlFile)
6dc4cca @klacke ""
authored May 25, 2004
360 end, List);
361 _ ->
362 ok
d659ba3 @klacke added a 'yaws -ls' command that lists all yaws servers on localhost
authored May 26, 2004
363
364 end,
365 init:stop().
6dc4cca @klacke ""
authored May 25, 2004
366
367
c9778e0 @klacke added support for 2 additional configure
authored Apr 27, 2006
368 lls(CtlFile0 = "ctl-" ++ Id) ->
369 CtlFile = filename:join([yaws_generated:ctldir(), CtlFile0]),
370 case {file:read_file_info(CtlFile),
371 file:read_file(CtlFile)} of
8c2b2ad @klacke *** empty log message ***
authored Apr 28, 2006
372 {{ok, FI}, {error, eacces}} ->
c9778e0 @klacke added support for 2 additional configure
authored Apr 27, 2006
373 User = yaws:uid_to_name(FI#file_info.uid),
374 io:format("~-15s~-10s~-10s~n",
8c2b2ad @klacke *** empty log message ***
authored Apr 28, 2006
375 [Id, "noaccess", User]);
c9778e0 @klacke added support for 2 additional configure
authored Apr 27, 2006
376 {{ok, FI}, {ok, _Bin}} ->
377 Running = case connect(Id) of
f4e3e44 @klacke patch by Sergei Golovan which fixed a CGI bug and made yaws_ctl safe
authored Jul 6, 2006
378 {ok, Sock, _Key} ->
d659ba3 @klacke added a 'yaws -ls' command that lists all yaws servers on localhost
authored May 26, 2004
379 gen_tcp:close(Sock),
380 "running";
381 {error, timeout} ->
382 "hanging??";
2c6c9b4 @klacke ""
authored May 26, 2004
383 {error, eacces} ->
384 "unknown";
92bafb4 @klacke removed the ability change userid, also stopped writing to /tmp/yaws …
authored Mar 9, 2006
385 _Err ->
2c6c9b4 @klacke ""
authored May 26, 2004
386 "stopped"
d659ba3 @klacke added a 'yaws -ls' command that lists all yaws servers on localhost
authored May 26, 2004
387 end,
c9778e0 @klacke added support for 2 additional configure
authored Apr 27, 2006
388 User = yaws:uid_to_name(FI#file_info.uid),
d659ba3 @klacke added a 'yaws -ls' command that lists all yaws servers on localhost
authored May 26, 2004
389 io:format("~-15s~-10s~-10s~n",
c9778e0 @klacke added support for 2 additional configure
authored Apr 27, 2006
390 [Id, Running, User]);
391 _ ->
392 ok
393 end;
394 lls(_) ->
395 ok.
d659ba3 @klacke added a 'yaws -ls' command that lists all yaws servers on localhost
authored May 26, 2004
396
6dc4cca @klacke ""
authored May 25, 2004
397
398
38fb85e @klacke ""
authored Apr 30, 2002
399 %% send a hup (kindof) to the yaws server to make it
400 %% reload its configuration and clear its caches
401
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
402 hup([SID]) ->
403 actl(SID, hup).
38fb85e @klacke ""
authored Apr 30, 2002
404
3dc56a7 @klacke javascript support in ehtml
authored Sep 12, 2002
405
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
406 %% stop a daemon
407 stop([SID]) ->
408 actl(SID, stop).
38fb85e @klacke ""
authored Apr 30, 2002
409
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
410 %% query a daemon for status/stats
411 status([SID]) ->
412 actl(SID, status).
413
414 load(X) ->
415 [SID | Modules] = lists:reverse(X),
416 actl(SID, {load, Modules}).
caa1a72 @carsten3347 Added command `-load' to yaws script.
carsten3347 authored Jul 16, 2003
417
6c84378 @klacke ""
authored Mar 22, 2004
418 check([Id, File| IncludeDirs]) ->
92bafb4 @klacke removed the ability change userid, also stopped writing to /tmp/yaws …
authored Mar 9, 2006
419 GC = yaws_config:make_default_gconf(false, undefined),
2f51c68 @klacke -check arg
authored Nov 20, 2002
420 GC2 = GC#gconf{include_dir = lists:map(fun(X) -> atom_to_list(X) end,
6c84378 @klacke ""
authored Mar 22, 2004
421 IncludeDirs),
422 id = atom_to_list(Id)
423 },
745bb4a @klacke ""
authored Mar 22, 2004
424 yaws_server:setup_dirs(GC2),
9ce9a25 @klacke ""
authored Mar 22, 2004
425 put(sc, #sconf{}),
426 put(gc, GC2),
a7e93df @klacke patch from Magnus froberg to get better control over the files genera…
authored Aug 28, 2006
427 put(use_yfile_name, true),
ef3a52a @klacke Removed the atoms in parse_post and parse query, backwards incompatib…
authored Mar 16, 2004
428 case yaws_compile:compile_file(atom_to_list(File)) of
06a1bef @klacke ""
authored Nov 22, 2002
429 {ok, [{errors, 0}| _Spec]} ->
a7e93df @klacke patch from Magnus froberg to get better control over the files genera…
authored Aug 28, 2006
430 timer:sleep(100),erlang:halt(0);
431 % init:stop();
06a1bef @klacke ""
authored Nov 22, 2002
432 _Other ->
a7e93df @klacke patch from Magnus froberg to get better control over the files genera…
authored Aug 28, 2006
433 timer:sleep(100),erlang:halt(1)
434 % init:stop()
2f51c68 @klacke -check arg
authored Nov 20, 2002
435 end.
436
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
437 %% control a daemon http/traffic tracer
438 trace([What, SID]) ->
439 actl(SID, {trace, What}).
440
2f51c68 @klacke -check arg
authored Nov 20, 2002
441
442
38fb85e @klacke ""
authored Apr 30, 2002
443
444
445
446
447
448
449
450
451
452
Something went wrong with that request. Please try again.