From dc6abe86d2730b16cb155a02b3ec9d79fcaa72f7 Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 5 Jul 2010 09:49:42 +0000 Subject: Make server write its pid file. Daemon class ported from pentominos. --- server/src/pracrod.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'server/src/pracrod.cc') diff --git a/server/src/pracrod.cc b/server/src/pracrod.cc index 64fb538..1488909 100644 --- a/server/src/pracrod.cc +++ b/server/src/pracrod.cc @@ -184,6 +184,7 @@ int main(int argc, char *argv[]) char *xml_basedir = NULL; char *debugstr = NULL; std::string database; + std::string pidfile; int option_index = 0; while(1) { @@ -199,11 +200,12 @@ int main(int argc, char *argv[]) {"debug", required_argument, 0, 'D'}, {"database", required_argument, 0, 'd'}, {"ssl", required_argument, 0, 's'}, + {"pidfile", required_argument, 0, 'P'}, {"logfile", required_argument, 0, 'L'}, {0, 0, 0, 0} }; - c = getopt_long (argc, argv, "D:hvfc:u:g:x:d:s:L:", + c = getopt_long (argc, argv, "D:hvfc:u:g:x:d:s:L:P:", long_options, &option_index); if (c == -1) @@ -234,6 +236,10 @@ int main(int argc, char *argv[]) xml_basedir = strdup(optarg); break; + case 'P': + pidfile = optarg; + break; + case 'L': logfile = optarg; break; @@ -313,7 +319,7 @@ int main(int argc, char *argv[]) signal(SIGINT, ctrl_c); PracroDaemon daemon; - daemon.run(user, group, !foreground); + daemon.run(user, group, !foreground, pidfile); // Clean up if(configfile) free(configfile); -- cgit v1.2.3