summaryrefslogtreecommitdiff
path: root/server/src/pracrod.cc
diff options
context:
space:
mode:
authordeva <deva>2010-07-05 09:49:42 +0000
committerdeva <deva>2010-07-05 09:49:42 +0000
commitdc6abe86d2730b16cb155a02b3ec9d79fcaa72f7 (patch)
tree0fa222007bd1827da42e01dedbafaa005faedf31 /server/src/pracrod.cc
parent04168eca33079dd27c60c894a54d76d4bc627c55 (diff)
Make server write its pid file. Daemon class ported from pentominos.
Diffstat (limited to 'server/src/pracrod.cc')
-rw-r--r--server/src/pracrod.cc10
1 files changed, 8 insertions, 2 deletions
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);