Skip to content

Instantly share code, notes, and snippets.

@gabamnml
Last active December 14, 2015 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabamnml/5116618 to your computer and use it in GitHub Desktop.
Save gabamnml/5116618 to your computer and use it in GitHub Desktop.
Real time dump mongo
var sys = require('sys') var exec = require('child_process').exec; function puts(error, stdout, stderr) { sys.puts(stdout) } function run () { console.log("Le quita a los ricos"); exec("mongodump --host 127.0.0.1 --port 27017 --db namedb --username username --password strongpass --out /mongodump", puts); setTimeout(function () { postinmongo(); }, 10000); } function postinmongo() { console.log("Le da a los pobres"); exec("mongorestore mongodump"); setTimeout(function () { run(); }, 3000); } run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment