Mongos returns exit code 0 even on errors. In the following example I would expect exit code 48 (net in use)
mkorn@xxx0:~$ mongos --port 50000 --configdb a.edelight.net:27017,b.edelight.net:27017,c.edelight.net:27017
Mon Jan 2 08:04:19 mongos db version v2.0.2, pdfile version 4.5 starting (--help for usage)
Mon Jan 2 08:04:19 git version: 514b122d308928517f5841888ceaa4246a7f18e3
Mon Jan 2 08:04:19 build info: Linux bs-linux64.10gen.cc 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_41
Mon Jan 2 08:04:19 SyncClusterConnection connecting to [a.edelight.net:27017]
Mon Jan 2 08:04:19 SyncClusterConnection connecting to [b.edelight.net:27017]
Mon Jan 2 08:04:19 SyncClusterConnection connecting to [c.edelight.net:27017]
Mon Jan 2 08:04:21 [Balancer] about to contact config servers and shards
Mon Jan 2 08:04:21 [websvr] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:51000
Mon Jan 2 08:04:21 [websvr] ERROR: addr already in use
Mon Jan 2 08:04:21 [Balancer] SyncClusterConnection connecting to [a.edelight.net:27017]
Mon Jan 2 08:04:21 [mongosMain] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:50000
Mon Jan 2 08:04:21 [mongosMain] ERROR: addr already in use
Mon Jan 2 08:04:21 [mongosMain] dbexit: rc:0
mkorn@xxx:~$ echo $?
0
I expect similar behaviour as when running a single mongod instance
mkorn@xxx:~$ mongod --port 50000 --dbpath . --nojournal
Mon Jan 2 08:07:07 [initandlisten] MongoDB starting : pid=489 port=50000 dbpath=. 64-bit host=xxx
Mon Jan 2 08:07:07 [initandlisten] db version v2.0.2, pdfile version 4.5
Mon Jan 2 08:07:07 [initandlisten] git version: 514b122d308928517f5841888ceaa4246a7f18e3
Mon Jan 2 08:07:07 [initandlisten] build info: Linux bs-linux64.10gen.cc 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_41
Mon Jan 2 08:07:07 [initandlisten] options:
Mon Jan 2 08:07:08 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:50000
Mon Jan 2 08:07:08 [initandlisten] ERROR: addr already in use
Mon Jan 2 08:07:08 [initandlisten] now exiting
Mon Jan 2 08:07:08 dbexit:
Mon Jan 2 08:07:08 [initandlisten] shutdown: going to close listening sockets...
Mon Jan 2 08:07:08 [initandlisten] shutdown: going to flush diaglog...
Mon Jan 2 08:07:08 [initandlisten] shutdown: going to close sockets...
Mon Jan 2 08:07:08 [websvr] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:51000
Mon Jan 2 08:07:08 [websvr] ERROR: addr already in use
Mon Jan 2 08:07:08 [initandlisten] shutdown: waiting for fs preallocator...
Mon Jan 2 08:07:08 [initandlisten] shutdown: closing all files...
Mon Jan 2 08:07:08 [initandlisten] closeAllFiles() finished
Mon Jan 2 08:07:08 [initandlisten] shutdown: removing fs lock...
Mon Jan 2 08:07:08 dbexit: really exiting now
mkorn@xxx:~$ echo $?
48