Skip to content

Commit

Permalink
removed the ability change userid, also stopped writing to /tmp/yaws …
Browse files Browse the repository at this point in the history
…and started to write to /home/klacke/.yaws instead. This is much better since we cannot now ever get into the situations where file ownership and umask stop us from controlling a daemon. Also cleaned up the start flags to the yaws script, all old flags are still there for backward scompatibilty.

git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@951 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information
Claes Wikstrom committed Mar 9, 2006
1 parent 56254f6 commit 92bafb4
Show file tree
Hide file tree
Showing 20 changed files with 329 additions and 649 deletions.
13 changes: 8 additions & 5 deletions include/yaws.hrl
Expand Up @@ -75,14 +75,15 @@
max_num_cached_bytes = 1000000, %% 1 MEG
max_size_cached_file = 8000,
large_file_chunk_size = 10240,
log_wrap_size = 1000000, % wrap logs after 1M
log_wrap_size = 10000000, % wrap logs after 10M
cache_refresh_secs = 30, % seconds (auto zero when debug)
include_dir = [], %% list of inc dirs for .yaws files
phpexe = "php", %% cgi capable php executable
yaws, %% server string
username, %% maybe run as a different user than root
uid, %% unix uid of user that started yaws
id = "default" %% string identifying this instance of yaws
%username, %% maybe run as a different user than root
%uid, %% unix uid of user that started yaws
id = "default", %% string identifying this instance of yaws
tmpdir
}).


Expand Down Expand Up @@ -256,5 +257,7 @@
traceoutput,
conf,
runmod,
embedded}).
embedded,
id
}).

92 changes: 59 additions & 33 deletions man/yaws.1
Expand Up @@ -16,106 +16,131 @@ dynamic content. See the user docs for more information on that topic.


.TP
\fB\-i\fR
\fB\-i | --interactive\fR
Interactive mode. This will start yaws in interactive mode with an erlang
prompt. All error_logger messages will be written to the tty as well in this
mode. Use this when developing yaws code.
.TP
\fB\-D\fR
\fB\-w | --winteractive\fR
Cygwin inteactive mode (werl)
\fB\--daemon\fR
Daemon mode. This will start yaws as a daemon.
.TP
\fB\-heart\fR
\fB\--heart\fR
This will cause the yaws system to be automatically restarted
in case it should crash. This switch also require the \fI-D\fR
in case it should crash. This switch also require the \fI--daemon\fR
switch to be present.
.TP
\fB\-d\fR
\fB\--debug\fR
Debug mode. This will produce some auxilliary error output for some
error conditions. It will also start the otp sasl lib for additional
error printouts.

.TP
\fB\-c file\fR
\fB\--conf file\fR
Use a different configuration file than the default. The default configuration file
when running as root is /etc/yaws.conf. When running as a non priviliged user, yaws
will search for its configuration file in the following order. First in
$HOME/yaws.conf, then in ./yaws.conf and finally in /etc/yaws.conf
.TP
\fB\-r module\fR
\fB\--runmod module\fR
Tells yaws to call \fImodule:start/0\fR at startup. This makes it possible
to startup user specific applications together with yaws.

.TP
\fB\-pa path\fR
\fB\--pa path\fR
Add path to the yaws system search path

.TP
\fB\-t\fR
\fB\--tracetraf\fR
Traffic trace mode. All traffic will be written to a trace file called trace.traffic
in the log directory.

.TP
\fB\-T\fR
\fB\--tracehttp\fR
HTTP trace mode. All HTTP messages will be written to a trace file called trace.http
in the log directory.

.TP
\fB\-x\fR
When yaws is put into trace mode using either -T or -t, traces are written to files. If we provide the -x flag, the trace will also be written to stdout.
\fB\--traceout\fR
When yaws is put into trace mode using either --tracetraf or --tracehttp, traces are written to files. If we provide the --traceout flag, the trace will also be written to stdout.

.TP
\fB\-M dir\fR
\fB\--trace\fR
Sames as --tracetraf --traceout. I.e. trace everything and write to stdout.

.TP
\fB\--mnesiadir dir\fR
Start Mnesia in directory <dir>

.TP
\fB\-sname xxx\fR
\fB\--sname xxx\fR
Start yaws as a distributed erlang node with name <xxx>
using the unqualified hostname as nodename postfix

.TP
\fB\--name xxx\fR
Start yaws as a distributed erlang node with name <xxx> using the
fully qualified hostname as nodename postfix

.TP
\fB\-proto_dist Mod\fR
\fB\--proto_dist Mod\fR
Use module Mod for erlang distribution. This is typically only used
when we want to run erlang distribution over SSL.

.TP
\fB\-erlarg STRING\fR
\fB\--erlarg STRING\fR
Pass STRING as an additional argument to the "erl" program.


.TP
\fB\--id ID\fR
This flag sets the id. If we're starting a daemon (or an interactive
system) it gives the Yaws server the identity ID. This means that the
server will write all internal files into the directory
$HOME/.yaws/ID. In particular it will write a file called
$HOME/.yaws/ID/ctl which contains the portnumber the daemon
is listening on for control request by the control command such
as "yaws --hup" etc.

If we're invoking a control command which should perform some
control function on the daemon, we mau have to give the --id flag also
to the control command. If we don't do this the control command
may interact with the wrong daemon due to finding the wrong "ctl" file.

The daemon may also optionally specify the "id" in the yaws.conf
configuration file.

.SH CONTROL OPTIONS
.PP
The following list of options are are used to control the daemon
from the "outside" while it is running.

.TP
\fB\-I id\fR
Only useful with the control commands, -h, -s and -S, -j and -load. It interacts
with the yaws server named "id" (as specified in the conf file for
that yaws server)


.TP
\fB\-h [-I id]\fR
\fB\--hup [--id ID]\fR
HUP the daemon. This forces the daemon to reread the configuration file.
It also makes
the daemon empty all its internal content caches.
Hence when updating the doc root,
HUPing the daemon is the fastest way to see the content updates.
.TP
\fB\-s [-I id]\fR
\fB\--stop [-I id]\fR
Stop the daemon (called id)
.TP
\fB\-ls \fR
Lists current ids and status of all yaws servers on localhost.
\fB\--ls \fR
Lists current ids and status of all yaws servers on localhost. In practice this
amounts to a listdir in $HOME/.yaws/yaws - and check wether the different
systems who has created files there are alive.
.TP
\fB-S [-I id]\fR
\fB--status [-I id]\fR
Query a running yaws daemon for its status, and print it.
.TP
\fB-load Modules [-I id]\fR
\fB--load Modules [-I id]\fR
Try to (re)load erlang modules into a running daemon. This is useful
after modifying appmods or modules used by scripts.

.TP
\fB-j [-I id] http | traffic | off\fR
\fB--ctltrace [--id ID] http | traffic | off\fR
Control the trace capabilities of a running yaws daemon. If the
http or traffic option is given, the daemon will write a log
for debug purposes into the logdir.
Expand All @@ -124,10 +149,11 @@ for debug purposes into the logdir.
.SH MISC OPTIONS

.TP
\fB-check YawsFile [IncDirs]\fR
Test compile a `.yaws' file.
\fB--check YawsFile [IncDirs ....]\fR
Test compile a `.yaws' file. Useful in Makefiles when we want to ensure
that all .yaws files are syntactically correct
.TP
\fB\-v\fR
\fB\--version\fR
output version information and exit
.SH AUTHOR
Written by Claes Wikstrom
Expand Down
13 changes: 6 additions & 7 deletions man/yaws.conf.5
Expand Up @@ -49,15 +49,14 @@ id of a yaws server to control it using the different ctl commands such
as:
.nf

# /usr/local/bin/yaws -I foobar -s
# /usr/local/bin/yaws --id foobar --stop

.fi
To stop the Yaws server with id "foobar". Only the user that started
the server called foobar is allowd to stop and control it. This is achieved
through file permissions on the control file which will reside in
"/tmp/yaws/foobar/ctl"

There can never be two yaws servers on the same machine with identical ids.
To stop the Yaws server with id "foobar". Each Yaws server will write
its internals data into a file called $HOME/.yaws/yaws/ID where ID the
identity of the server. In particular it will write a file called
$HOME/.yaws/yaws/ID/ctl which contain the portnumber where the server is
listening for control commands.

.TP
\fB include_dir = Directory\fR
Expand Down

0 comments on commit 92bafb4

Please sign in to comment.