summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-12-21 19:21:37 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-12-21 19:21:37 +0300
commita079dac866ac4e166a8d6e40f978af74e8398583 (patch)
treed5cf47d5b7bf9414748c11d313251644dacc3be0 /src/main.c
parentc6e6ea88a2e03609b0be013d2df0de1c6062712f (diff)
downloadrspamd-a079dac866ac4e166a8d6e40f978af74e8398583.tar.gz
rspamd-a079dac866ac4e166a8d6e40f978af74e8398583.zip
* Add ability to specify pid file from command line (for rc scripts)
* Do not use flock directly in pidfile handling
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index dd17b98d1..fa861b86f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -157,7 +157,7 @@ static void
read_cmd_line (int argc, char **argv, struct config_file *cfg)
{
int ch;
- while ((ch = getopt (argc, argv, "tVChfc:u:g:")) != -1) {
+ while ((ch = getopt (argc, argv, "tVChfc:u:g:p:")) != -1) {
switch (ch) {
case 'f':
cfg->no_fork = 1;
@@ -186,6 +186,11 @@ read_cmd_line (int argc, char **argv, struct config_file *cfg)
cfg->rspamd_group = memory_pool_strdup (cfg->cfg_pool, optarg);
}
break;
+ case 'p':
+ if (optarg) {
+ cfg->pid_file = memory_pool_strdup (cfg->cfg_pool, optarg);
+ }
+ break;
case 'h':
case '?':
default:
@@ -197,7 +202,11 @@ read_cmd_line (int argc, char **argv, struct config_file *cfg)
"-C: Dump symbols cache stats and exit\n"
"-V Print all rspamd variables and exit\n"
"-f: Do not daemonize main process\n"
- "-c: Specify config file (./rspamd.conf is used by default)\n" "-u: User to run rspamd as\n" "-g: Group to run rspamd as\n");
+ "-c: Specify config file (./rspamd.conf is used by default)\n"
+ "-u: User to run rspamd as\n"
+ "-g: Group to run rspamd as\n"
+ "-p: Path to pidfile\n"
+ );
exit (0);
break;
}
@@ -753,7 +762,6 @@ main (int argc, char **argv, char **env)
init_signals (&signals, sig_handler);
-
if (write_pid (rspamd) == -1) {
msg_err ("main: cannot write pid file %s", rspamd->cfg->pid_file);
exit (-errno);