shell: make require take a tag

This commit is contained in:
Girish Ramakrishnan
2024-10-14 19:10:31 +02:00
parent 02823c4158
commit a9e1d7641d
27 changed files with 162 additions and 156 deletions

View File

@@ -48,7 +48,7 @@ const apps = require('./apps.js'),
services = require('./services.js'),
settings = require('./settings.js'),
semver = require('semver'),
shell = require('./shell.js'),
shell = require('./shell.js')('docker'),
safe = require('safetydance'),
timers = require('timers/promises'),
volumes = require('./volumes.js');
@@ -245,7 +245,7 @@ async function getAddressesForPort53() {
const addresses = [];
for (const phy of physicalDevices) {
const [error, output] = await safe(shell.exec('getAddressesForPort53', `ip -f inet -j addr show dev ${phy.name} scope global`, {}));
const [error, output] = await safe(shell.exec(`ip -f inet -j addr show dev ${phy.name} scope global`, {}));
if (error) continue;
const inet = safe.JSON.parse(output) || [];
for (const r of inet) {
@@ -650,7 +650,7 @@ async function update(name, memory) {
// scale back db containers, if possible. this is retried because updating memory constraints can fail
// with failed to write to memory.memsw.limit_in_bytes: write /sys/fs/cgroup/memory/docker/xx/memory.memsw.limit_in_bytes: device or resource busy
for (let times = 0; times < 10; times++) {
const [error] = await safe(shell.exec(`update(${name})`, `docker update --memory ${memory} --memory-swap -1 ${name}`, {}));
const [error] = await safe(shell.exec(`docker update --memory ${memory} --memory-swap -1 ${name}`, {}));
if (!error) return;
await timers.setTimeout(60 * 1000);
}