8 Commits

Author SHA1 Message Date
119f20915e 1.0.18 2019-09-06 17:33:02 +02:00
ce1fa6640b fix(core): update 2019-09-06 17:33:01 +02:00
8957e03445 1.0.17 2019-09-05 16:19:18 +02:00
3df86bee10 fix(core): update 2019-09-05 16:19:18 +02:00
65326710ab 1.0.16 2019-09-05 16:14:05 +02:00
2e174c9f55 fix(core): update 2019-09-05 16:14:05 +02:00
9e42910456 1.0.15 2019-09-05 16:04:38 +02:00
ff85cee528 fix(core): update 2019-09-05 16:04:38 +02:00
5 changed files with 16 additions and 10 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartdaemon", "name": "@pushrocks/smartdaemon",
"version": "1.0.14", "version": "1.0.18",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartdaemon", "name": "@pushrocks/smartdaemon",
"version": "1.0.14", "version": "1.0.18",
"private": false, "private": false,
"description": "start scripts as long running daemons and manage them", "description": "start scripts as long running daemons and manage them",
"main": "dist/index.js", "main": "dist/index.js",

View File

@ -77,4 +77,8 @@ export class SmartDaemonService implements ISmartDaemonServiceConstructorOptions
public async delete() { public async delete() {
await this.smartdaemonRef.systemdManager.deleteService(this); await this.smartdaemonRef.systemdManager.deleteService(this);
} }
public async reload() {
await this.smartdaemonRef.systemdManager.reload();
}
} }

View File

@ -35,8 +35,4 @@ export class SmartDaemon {
await serviceToAdd.save(); await serviceToAdd.save();
return serviceToAdd; return serviceToAdd;
} }
public async init() {
await this.systemdManager.init();
}
} }

View File

@ -94,9 +94,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 +112,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)}`
); );
@ -128,5 +128,11 @@ export class SmartDaemonSystemdManager {
} }
} }
public async init() {} public async reload() {
if (await this.checkElegibility()) {
await this.execute(
`systemctl daemon-reload`
);
}
}
} }