Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
119f20915e | |||
ce1fa6640b | |||
8957e03445 | |||
3df86bee10 | |||
65326710ab | |||
2e174c9f55 | |||
9e42910456 | |||
ff85cee528 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartdaemon",
|
||||
"version": "1.0.14",
|
||||
"version": "1.0.18",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartdaemon",
|
||||
"version": "1.0.14",
|
||||
"version": "1.0.18",
|
||||
"private": false,
|
||||
"description": "start scripts as long running daemons and manage them",
|
||||
"main": "dist/index.js",
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -35,8 +35,4 @@ export class SmartDaemon {
|
||||
await serviceToAdd.save();
|
||||
return serviceToAdd;
|
||||
}
|
||||
|
||||
public async init() {
|
||||
await this.systemdManager.init();
|
||||
}
|
||||
}
|
||||
|
@ -94,9 +94,6 @@ export class SmartDaemonSystemdManager {
|
||||
|
||||
public async saveService(serviceArg: SmartDaemonService) {
|
||||
if (await this.checkElegibility()) {
|
||||
if (serviceArg.alreadyExists) {
|
||||
this.stopService(serviceArg);
|
||||
}
|
||||
await plugins.smartfile.memory.toFs(
|
||||
this.smartdaemonRef.templateManager.generateUnitFileForService(serviceArg),
|
||||
SmartDaemonSystemdManager.createFilePathFromServiceName(serviceArg.name)
|
||||
@ -115,6 +112,9 @@ export class SmartDaemonSystemdManager {
|
||||
public async enableService(serviceArg: SmartDaemonService) {
|
||||
if (await this.checkElegibility()) {
|
||||
await this.saveService(serviceArg);
|
||||
if (serviceArg.alreadyExists) {
|
||||
await this.execute(`systemctl daemon-reload`);
|
||||
}
|
||||
await this.execute(
|
||||
`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`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user