fixes various bugs for Tor service

This commit is contained in:
Shahrad Elahi
2024-02-12 13:05:46 +03:30
parent 0d9128cfab
commit b3b9beddf3
9 changed files with 78 additions and 41 deletions

View File

@@ -2,8 +2,12 @@ import { json, type RequestHandler } from '@sveltejs/kit';
import { execa } from 'execa';
export const GET: RequestHandler = async ({ params }) => {
const { stdout } = await execa('screen', ['-ls'], { shell: true });
const isRunning = stdout.includes(params.serviceName!);
try {
const { stdout } = await execa('screen', ['-ls'], { shell: true });
const isRunning = stdout.includes(params.serviceName!);
return json({ healthy: isRunning });
return json({ healthy: isRunning });
} catch (e) {
return json({ healthy: false });
}
};