I'm running shell script file from nodeJS file i need to send some parameters to shell script and use it in shell script
My js file `
var dbname = development.db.uri;
console.log(dbname);
var myscript = exec('sh ./scripts/mongo-backup.sh',+ dbname );
myscript.stdout.on('data',function(data){
console.log("!@#$%^&*&@#$%^&*$##$%^&*");
console.log(data); // process output will be displayed here
});
myscript.stderr.on('data',function(data){
console.log(data); // process error output will be displayed here
});
and here is my shell script
#!/bin/bash
echo "Creating Database Backup"
#need to access dbname from JS FILE
MONGO_DATABASE= dbname
APP_NAME="app-name"
USERNAME=$(sudo echo $USER)
`
via Srinivas
No comments:
Post a Comment