From 10c60f03d2dbcee7b56525c1845f3427550fabfa Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 24 Jan 2014 00:12:37 +0000 Subject: [PATCH] Update documentation. --- doc/markdown/architecture/index.md | 38 +++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/doc/markdown/architecture/index.md b/doc/markdown/architecture/index.md index 33669f2d5..d4f5d1fb6 100644 --- a/doc/markdown/architecture/index.md +++ b/doc/markdown/architecture/index.md @@ -108,10 +108,46 @@ is a set of token chains, indexed by the first hash. A new token may be inserted chain, and if this chain is full then rspamd tries to expire less significant tokens to insert a new one. It is possible to obtain the current state of tokens by running - rspamc stat` + rspamc stat command that asks controller for free and used tokens in each statfile. Please note that if a statfile is close to be completely filled then during subsequent learning you will loose existing data. Therefore, it is recommended to increase size for such statfiles. +## Running rspamd + +There are several command-line options that can be passed to rspamd. All of them can be displayed by passing `--help` argument: + +All options are optional: by default rspamd would try to read `etc/rspamd.conf` config file and run as daemon. Also there is test mode that can be turned on by passing `-t` argument. In test mode, rspamd reads config file and checks its syntax. If a configuration file is OK, then exit code is zero. Test mode is useful for testing new config file withou rspamd restart. `--convert-config` option can be used to convert old style (pre 0.6.0) config to [ucl](../configuration/ucl.md) one: + + $ rspamd -c ./rspamd.xml --convert-conf ./rspamd.conf + + +## Managing rspamd using signals + +First of all, it is important to note that all user's signals should be sent to rspamd main process and not to its children (as for child processes these signals can have other meanings). To determine which process is main you can use two ways: + +- by reading pidfile: + + $ cat pidfile + +- by getting process info: + + $ ps auxwww | grep rspamd + nobody 28378 0.0 0.2 49744 9424 rspamd: main process (rspamd) + nobody 64082 0.0 0.2 50784 9520 rspamd: worker process (rspamd) + nobody 64083 0.0 0.3 51792 11036 rspamd: worker process (rspamd) + nobody 64084 0.0 2.7 158288 114200 rspamd: controller process (rspamd) + nobody 64085 0.0 1.8 116304 75228 rspamd: fuzzy storage (rspamd) + + $ ps auxwww | grep rspamd | grep main + nobody 28378 0.0 0.2 49744 9424 rspamd: main process (rspamd) + +After getting the pid of main process it is possible to manage rspamd with signals: + +- `SIGHUP` - restart rspamd: reread config file, start new workers (as well as controller and other processes), stop accepting connections by old workers, reopen all log files. Note that old workers would be terminated after one minute that should allow to process all pending requests. All new requests to rspamd will be processed by newly started workers. +- `SIGTERM` - terminate rspamd system. +- `SIGUSR1` - reopen log files (useful for log files rotation). + +These signals may be used in start scripts as it is done in `FreeBSD` start script. Restarting of rspamd is performed softly: no connections are dropped and if a new config is incorrect then the old config is used. \ No newline at end of file -- 2.39.5