fix for disk blocking
parent
0838022eae
commit
cb097067b5
|
@ -6,16 +6,18 @@ export default async function storage(client: Client) {
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
const accounts = await client.db.Account.find();
|
const accounts = await client.db.Account.find();
|
||||||
for (const account of accounts) {
|
for (const account of accounts) {
|
||||||
const res = await client.util.exec(`du -bs /home/${account.username}`);
|
setTimeout(async () => {
|
||||||
let bytes = Number(res.split('/')[0].replace('\t', ''));
|
const res = await client.util.exec(`du -bs /home/${account.username}`);
|
||||||
try {
|
let bytes = Number(res.split('/')[0].replace('\t', ''));
|
||||||
await fs.access(`/var/mail/${account.username}`, fs.constants.F_OK);
|
try {
|
||||||
const res2 = await client.util.exec(`du -bs /var/mail/${account.username}`);
|
await fs.access(`/var/mail/${account.username}`, fs.constants.F_OK);
|
||||||
bytes += Number(res2.split('/')[0].replace('\t', ''));
|
const res2 = await client.util.exec(`du -bs /var/mail/${account.username}`);
|
||||||
} catch {
|
bytes += Number(res2.split('/')[0].replace('\t', ''));
|
||||||
bytes += 0;
|
} catch {
|
||||||
}
|
bytes += 0;
|
||||||
await client.redis.set(`storage-${account.username}`, bytes);
|
}
|
||||||
|
await client.redis.set(`storage-${account.username}`, bytes);
|
||||||
|
}, 600000);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
await main();
|
await main();
|
||||||
|
|
Loading…
Reference in New Issue