var restore=async function (db,dir) { if(!db.dbPath || !db.host || !db.name || !db.backPath) { return } let fileName="mongorestore"; if(path.sep=="\\") { fileName+=".exe"; } db.dbPath=path.join(db.dbPath,fileName); db.backPath=path.join(db.backPath,dir,db.name) let str=`${db.dbPath} -h ${db.host} -d ${db.name} ${db.backPath} --drop`; if(db.user && db.pass && db.authDb) { str+=` -u ${db.user} -p ${db.pass} --authenticationDatabase ${db.authDb}` } await (child_process.execAsync(str)); }
var backup=async function (db,version) { if(!db.dbPath || !db.host || !db.name || !db.backPath) { return } let fileName="mongodump"; if(path.sep=="\\") { fileName+=".exe"; } let date=moment().format("YYYYMMDDHHmmss"); db.dbPath=path.join(db.dbPath,fileName); db.backPath=path.join(db.backPath,`${version}@${date}`) let str=`${db.dbPath} -h ${db.host} -d ${db.name} -o ${db.backPath}`; if(db.user && db.pass && db.authDb) { str+=` -u ${db.user} -p ${db.pass} --authenticationDatabase ${db.authDb}` } await (child_process.execAsync(str)); }
getProcessMemoryUsage (pid) { return execAsync(`awk '/VmRSS:/{ rss = $2 } END { print rss }' /proc/${pid}/status`) .then(stdout => Number(stdout)) }
/** * Runs cucumber features * @param {*} req * @param {*} res * @param {*} next */ async runFeatures(req, res, next){ let result = await execAsync('cd ../;npm run test:features'); res.status(200).json(result); }
console.log('NOTICE: Fixing incorrect Saltstack version configuration.') console.log('Installing and configuring Saltstack properly ...') await child_process.execAsync('apt-get remove -y salt-common') await fs.writeFileAsync(aptSourceList, `deb [arch=amd64] http://repo.saltstack.com/py3/ubuntu/${osVersion}/amd64/${saltstackVersion} ${osCodename} main`) await child_process.execAsync(`wget -O - https://repo.saltstack.com/py3/ubuntu/${osVersion}/amd64/${saltstackVersion}/SALTSTACK-GPG-KEY.pub | apt-key add -`) await child_process.execAsync('apt-get update') await child_process.execAsync('apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y --allow-change-held-packages salt-common', { env: { ...process.env, console.log('Installing and configuring SaltStack properly ...') await fs.writeFileAsync(aptSourceList, `deb [arch=amd64] http://repo.saltstack.com/py3/ubuntu/${osVersion}/amd64/${saltstackVersion} ${osCodename} main`) await child_process.execAsync(`wget -O - https://repo.saltstack.com/py3/ubuntu/${osVersion}/amd64/${saltstackVersion}/SALTSTACK-GPG-KEY.pub | apt-key add -`) await child_process.execAsync('apt-get update') await child_process.execAsync('apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y --allow-change-held-packages salt-common', { env: { ...process.env,
let stdout = (await execAsync(`${VBexe} hostonlyif create`)).stdout; VBOXNET = stdout.substr(stdout.indexOf(`'`) + 1, stdout.lastIndexOf(`'`) - stdout.indexOf(`'`) - 1); console.log('created adapter:', VBOXNET);
getAvailableMemory () { return execAsync(`awk '/MemAvailable:/{ mem = $2 } END { print mem }' /proc/meminfo`) .then(stdout => Number(stdout)) }