add system.du
This commit is contained in:
@@ -4,7 +4,8 @@ exports = module.exports = {
|
||||
getDisks,
|
||||
checkDiskSpace,
|
||||
getMemory,
|
||||
getMemoryAllocation
|
||||
getMemoryAllocation,
|
||||
du
|
||||
};
|
||||
|
||||
const apps = require('./apps.js'),
|
||||
@@ -16,11 +17,22 @@ const apps = require('./apps.js'),
|
||||
docker = require('./docker.js'),
|
||||
notifications = require('./notifications.js'),
|
||||
os = require('os'),
|
||||
path = require('path'),
|
||||
paths = require('./paths.js'),
|
||||
safe = require('safetydance'),
|
||||
settings = require('./settings.js'),
|
||||
shell = require('./shell.js'),
|
||||
volumes = require('./volumes.js');
|
||||
|
||||
const DU_CMD = path.join(__dirname, 'scripts/du.sh');
|
||||
|
||||
async function du(file) {
|
||||
const [error, stdoutResult] = await safe(shell.promises.sudo('system', [ DU_CMD, file ], {}));
|
||||
if (error) throw new BoxError(BoxError.FS_ERROR, error);
|
||||
|
||||
return parseInt(stdoutResult.trim(), 10);
|
||||
}
|
||||
|
||||
async function getVolumeDisks(appsDataDisk) {
|
||||
assert.strictEqual(typeof appsDataDisk, 'string');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user