Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start mongodb service when my electron app starts

I packaged my electron app. When I start my electron app, I want my MongoDB service to start automatically on the system installed locally. How can I achieve this through my node code?

like image 910
Ajay Kumar Avatar asked Dec 11 '15 09:12

Ajay Kumar


2 Answers

hope this help you.

 spawn = require("child_process").spawn,
 mongo_server = spawn("mongod.exe", ["c:/mongo_path"], { cwd: process.cwd() })
like image 76
SAMUEL OSPINA Avatar answered Nov 15 '22 04:11

SAMUEL OSPINA


If you installed MongoDB with agt-get (or ony similar manager), probably it will start automatically on systems boot. I haven used electron, but if it is possible to use node modules, you can do child_process.exec on your project startup.

like image 37
Nodari Lipartiya Avatar answered Nov 15 '22 05:11

Nodari Lipartiya