fix(core): update

This commit is contained in:
Philipp Kunz 2019-09-05 16:04:38 +02:00
parent 2a9fff0185
commit ff85cee528

View File

@ -79,6 +79,9 @@ export class SmartDaemonSystemdManager {
public async startService(serviceArg: SmartDaemonService) { public async startService(serviceArg: SmartDaemonService) {
if (await this.checkElegibility()) { if (await this.checkElegibility()) {
if (serviceArg.alreadyExists) {
await this.stopService(serviceArg);
}
await this.execute( await this.execute(
`systemctl start ${SmartDaemonSystemdManager.createServiceNameFromServiceName(serviceArg.name)}` `systemctl start ${SmartDaemonSystemdManager.createServiceNameFromServiceName(serviceArg.name)}`
); );
@ -94,9 +97,6 @@ export class SmartDaemonSystemdManager {
public async saveService(serviceArg: SmartDaemonService) { public async saveService(serviceArg: SmartDaemonService) {
if (await this.checkElegibility()) { if (await this.checkElegibility()) {
if (serviceArg.alreadyExists) {
this.stopService(serviceArg);
}
await plugins.smartfile.memory.toFs( await plugins.smartfile.memory.toFs(
this.smartdaemonRef.templateManager.generateUnitFileForService(serviceArg), this.smartdaemonRef.templateManager.generateUnitFileForService(serviceArg),
SmartDaemonSystemdManager.createFilePathFromServiceName(serviceArg.name) SmartDaemonSystemdManager.createFilePathFromServiceName(serviceArg.name)
@ -115,6 +115,9 @@ export class SmartDaemonSystemdManager {
public async enableService(serviceArg: SmartDaemonService) { public async enableService(serviceArg: SmartDaemonService) {
if (await this.checkElegibility()) { if (await this.checkElegibility()) {
await this.saveService(serviceArg); await this.saveService(serviceArg);
if (serviceArg.alreadyExists) {
await this.execute(`systemctl daemon-reload`);
}
await this.execute( await this.execute(
`systemctl enable ${SmartDaemonSystemdManager.createServiceNameFromServiceName(serviceArg.name)}` `systemctl enable ${SmartDaemonSystemdManager.createServiceNameFromServiceName(serviceArg.name)}`
); );