Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
dd5e1a978d | |||
692602b463 | |||
382b694027 | |||
de831b086f |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartdaemon",
|
"name": "@pushrocks/smartdaemon",
|
||||||
"version": "1.0.6",
|
"version": "1.0.8",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartdaemon",
|
"name": "@pushrocks/smartdaemon",
|
||||||
"version": "1.0.6",
|
"version": "1.0.8",
|
||||||
"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",
|
||||||
|
@ -17,7 +17,7 @@ export class SmartDaemonService implements SmartDaemonServiceConstructorOptions
|
|||||||
for (const key of Object.keys(optionsArg)) {
|
for (const key of Object.keys(optionsArg)) {
|
||||||
service[key] = optionsArg[key];
|
service[key] = optionsArg[key];
|
||||||
}
|
}
|
||||||
|
return service;
|
||||||
}
|
}
|
||||||
|
|
||||||
public options: SmartDaemonServiceConstructorOptions;
|
public options: SmartDaemonServiceConstructorOptions;
|
||||||
@ -50,4 +50,8 @@ export class SmartDaemonService implements SmartDaemonServiceConstructorOptions
|
|||||||
* pauses the service
|
* pauses the service
|
||||||
*/
|
*/
|
||||||
public pause() {};
|
public pause() {};
|
||||||
|
|
||||||
|
public save() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,21 @@ export class SmartDaemon {
|
|||||||
this.systemdManager = new SmartDaemonSystemdManager(this);
|
this.systemdManager = new SmartDaemonSystemdManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async addService(serviceName: string, workingDirectory): Promise<SmartDaemonService> {
|
public async addService(nameArg: string, commandArg: string, workingDirectoryArg?: string): Promise<SmartDaemonService> {
|
||||||
|
let serviceToAdd: SmartDaemonService;
|
||||||
const existingService = this.serviceMap.find(serviceArg => {
|
const existingService = this.serviceMap.find(serviceArg => {
|
||||||
return serviceArg
|
return serviceArg.name === nameArg;
|
||||||
|
});
|
||||||
|
if (!existingService) {
|
||||||
|
serviceToAdd = await SmartDaemonService.createFromOptions(this, {
|
||||||
|
command: commandArg,
|
||||||
|
name: nameArg,
|
||||||
|
workingDir: workingDirectoryArg
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
return serviceToAdd;
|
||||||
};
|
};
|
||||||
|
|
||||||
public async init() {
|
public async init() {
|
||||||
|
@ -24,9 +24,3 @@ export {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// third party
|
// third party
|
||||||
|
|
||||||
import * as fs from 'fs-extra';
|
|
||||||
|
|
||||||
export {
|
|
||||||
fs
|
|
||||||
};
|
|
Reference in New Issue
Block a user