0.1.2 • Published 9 years ago

mongo-server-manager v0.1.2

Weekly downloads
2
License
ISC
Repository
github
Last release
9 years ago

Install

npm install mongo-server-manager

Test

require coffee-script and mocha to be installed.

npm test

Usage

I use this module to manage a mongod instance for a desktop application as an embeded database.

# all option is critical
# though port and host will fallback to 27017 and localhost
# if not provided.
service = manager.createInstance {
    logPath:"./test/db/log"
    ,pidPath:"./test/db/mongod.pid"
    ,dbPath:"./test/db"
    ,port:12345
    ,host:"localhost"
    ,binPath:"mongod"
}
service.isDaemonUp (err,pid)->
    # if daemonis up return pid
    # or pid is false
    if not pid
        service.start (err)->
	    # shouldn't has err
            service.isOnline (err,online)->
	        # online should be true 
		service.stop (err)->
		    process.exit()

Difference between isDaemonUp and isOnline is that isDaemonUp will only check the pid file and corresponding process is running, wile isOnline will only try to connection to the host and port and make sure it's a mongodb service.

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago