I need to run mongodump command with below arguments
var dbhost = mongoose.connection.host || "127.0.0.1",
dbport = mongoose.connection.port,
dbname = mongoose.connection.name,
dbuser = mongoose.connection.options.user,
dbpass = mongoose.connection.options.pass,
backupPath = path,
date = new Date(),
currentDate = date.toLocaleString(),
backupFileName ='DBBACKUP-'+currentDate;
how to pass above variables to child process
var backupDB = spawn('mongodump --host dbhost --port dbport --username dbuser --password dbpass --db dbname --archive=backupPath/backupFileName.gz --gzip');
backupDB.stdout.on('data',function(data){
console.log('stdout: ' + data);//
});
via Srinivas
No comments:
Post a Comment