From ce1fa6640b5b7f9091c9fff42838dafe1075eaca Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Fri, 6 Sep 2019 17:33:01 +0200 Subject: [PATCH] fix(core): update --- ts/smartdaemon.classes.service.ts | 4 ++++ ts/smartdaemon.classes.smartdaemon.ts | 4 ---- ts/smartdaemon.classes.systemdmanager.ts | 11 +++++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ts/smartdaemon.classes.service.ts b/ts/smartdaemon.classes.service.ts index f7e163d..2459c76 100644 --- a/ts/smartdaemon.classes.service.ts +++ b/ts/smartdaemon.classes.service.ts @@ -77,4 +77,8 @@ export class SmartDaemonService implements ISmartDaemonServiceConstructorOptions public async delete() { await this.smartdaemonRef.systemdManager.deleteService(this); } + + public async reload() { + await this.smartdaemonRef.systemdManager.reload(); + } } diff --git a/ts/smartdaemon.classes.smartdaemon.ts b/ts/smartdaemon.classes.smartdaemon.ts index 53cd889..442367d 100644 --- a/ts/smartdaemon.classes.smartdaemon.ts +++ b/ts/smartdaemon.classes.smartdaemon.ts @@ -35,8 +35,4 @@ export class SmartDaemon { await serviceToAdd.save(); return serviceToAdd; } - - public async init() { - await this.systemdManager.init(); - } } diff --git a/ts/smartdaemon.classes.systemdmanager.ts b/ts/smartdaemon.classes.systemdmanager.ts index 581e652..c29eb6e 100644 --- a/ts/smartdaemon.classes.systemdmanager.ts +++ b/ts/smartdaemon.classes.systemdmanager.ts @@ -79,9 +79,6 @@ export class SmartDaemonSystemdManager { public async startService(serviceArg: SmartDaemonService) { if (await this.checkElegibility()) { - if (serviceArg.alreadyExists) { - await this.stopService(serviceArg); - } await this.execute( `systemctl start ${SmartDaemonSystemdManager.createServiceNameFromServiceName(serviceArg.name)}` ); @@ -131,5 +128,11 @@ export class SmartDaemonSystemdManager { } } - public async init() {} + public async reload() { + if (await this.checkElegibility()) { + await this.execute( + `systemctl daemon-reload` + ); + } + } }