mirror of
https://github.com/unraid/api.git
synced 2026-01-04 15:39:52 -06:00
fix: restart command elegant
This commit is contained in:
@@ -12,19 +12,19 @@ export class RestartCommand extends CommandRunner {
|
|||||||
|
|
||||||
async run(_): Promise<void> {
|
async run(_): Promise<void> {
|
||||||
try {
|
try {
|
||||||
this.logger.info('Restarting the Unraid API');
|
this.logger.info('Restarting the Unraid API...');
|
||||||
const { stderr, stdout } = await execa(PM2_PATH, [
|
const { stderr, stdout } = await execa(PM2_PATH, [
|
||||||
'restart',
|
'restart',
|
||||||
ECOSYSTEM_PATH,
|
ECOSYSTEM_PATH,
|
||||||
'--update-env',
|
'--update-env',
|
||||||
]);
|
]);
|
||||||
this.logger.info('Unraid API restarted');
|
|
||||||
if (stderr) {
|
if (stderr) {
|
||||||
this.logger.error(stderr);
|
this.logger.error(stderr);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
} else if (stdout) {
|
||||||
if (stdout) {
|
|
||||||
this.logger.info(stdout);
|
this.logger.info(stdout);
|
||||||
|
} else {
|
||||||
|
this.logger.info('Unraid API restarted');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user