diff options
author | Geir Magnusson Jr <geir@pthbbbbbb-2.local> | 2008-03-31 12:02:04 -0400 |
---|---|---|
committer | Geir Magnusson Jr <geir@pthbbbbbb-2.local> | 2008-03-31 12:02:04 -0400 |
commit | 49a9019ec686a968d9ee44ce329d7c5a62a7411e (patch) | |
tree | 53a725bc27a5979037ad39503cb138b126ae1901 | |
parent | 985d443af0c39a46e3c0257a981595f36cbb7665 (diff) | |
download | mongo-49a9019ec686a968d9ee44ce329d7c5a62a7411e.tar.gz |
Add alternative starting parameters to allow override of listening port and db data path
$ ./db --port 12345 --dbpath /foo/bar/baz
-rw-r--r-- | db/db.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/db/db.cpp b/db/db.cpp index 0b06c66288f..1023bfbb02d 100644 --- a/db/db.cpp +++ b/db/db.cpp @@ -280,7 +280,7 @@ void listen(int port) { cout << "db version: 104 mar2008 minilex" << endl;
pdfileInit();
testTheDb();
- cout << curTimeMillis() % 10000 << " waiting for connections...\n" << endl;
+ cout << curTimeMillis() % 10000 << " waiting for connections on port " << port << " ...\n" << endl;
OurListener l(port);
l.listen();
}
@@ -600,6 +600,33 @@ int main(int argc, char* argv[], char *envp[] ) goingAway = true;
return 0;
}
+
+ /*
+ * *** POST STANDARD SWITCH METHOD - if we don't satisfy, we switch to a
+ * slightly different mode where "run" is assumed and we can set values
+ */
+
+ for (int i = 1; i < argc; i++) {
+
+ char *s = argv[i];
+
+ if (s && strcmp(s, "--port") == 0) {
+ port = atoi(argv[++i]);
+ }
+ else if (s && strcmp(s, "--dbpath") == 0) {
+ dbpath = argv[++i];
+ }
+ }
+
+ cout << "10Gen DB : starting : port = " << port << " dbpath = " << dbpath << endl;
+
+ // note - this code is copied from the "run" DwightVerb
+
+ JavaJS = new JavaJSImpl();
+ javajstest();
+ listen(port);
+ goingAway = true;
+ return 0;
}
cout << "usage:\n";
@@ -610,6 +637,9 @@ int main(int argc, char* argv[], char *envp[] ) cout << " dev run in dev mode (diff db loc, diff port #)" << endl;
cout << " longmsg send a long test message to the db server" << endl;
cout << " msglots send a bunch of test messages, and then wait for answer on the last one" << endl;
+ cout << endl << "Alternate Usage :" << endl;
+ cout << " --port <portno> --dbpath <root>" << endl << endl;
+
goingAway = true;
return 0;
}
|