Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
ceb30c7ac2 | |||
0df90eec5d | |||
261031a49c | |||
615cc6aa7c |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartdaemon",
|
"name": "@pushrocks/smartdaemon",
|
||||||
"version": "1.0.9",
|
"version": "1.0.11",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartdaemon",
|
"name": "@pushrocks/smartdaemon",
|
||||||
"version": "1.0.9",
|
"version": "1.0.11",
|
||||||
"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",
|
||||||
|
@ -8,4 +8,13 @@ tap.test('should create an instance of smartdaemon', async () => {
|
|||||||
expect(testSmartdaemon).to.be.instanceOf(smartdaemon.SmartDaemon);
|
expect(testSmartdaemon).to.be.instanceOf(smartdaemon.SmartDaemon);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tap.test('should create a service', async () => {
|
||||||
|
testSmartdaemon.addService({
|
||||||
|
command: 'npm -v',
|
||||||
|
description: 'displays the npm version',
|
||||||
|
name: 'npmversion',
|
||||||
|
workingDir: __dirname
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
@ -33,10 +33,10 @@ export class SmartDaemon {
|
|||||||
} else {
|
} else {
|
||||||
serviceToAdd = existingService;
|
serviceToAdd = existingService;
|
||||||
Object.assign(serviceToAdd, optionsArg);
|
Object.assign(serviceToAdd, optionsArg);
|
||||||
await serviceToAdd.save();
|
|
||||||
}
|
}
|
||||||
|
await serviceToAdd.save();
|
||||||
return serviceToAdd;
|
return serviceToAdd;
|
||||||
};
|
}
|
||||||
|
|
||||||
public async init() {
|
public async init() {
|
||||||
await this.systemdManager.init();
|
await this.systemdManager.init();
|
||||||
|
@ -4,7 +4,7 @@ import { SmartDaemon } from './smartdaemon.classes.smartdaemon';
|
|||||||
|
|
||||||
export class SmartDaemonSystemdManager {
|
export class SmartDaemonSystemdManager {
|
||||||
// STATIC
|
// STATIC
|
||||||
private static smartDaemonNamespace = 'smartdaemon_';
|
private static smartDaemonNamespace = 'smartdaemon';
|
||||||
public static createFileNameFromServiceName = (serviceNameArg: string) => {
|
public static createFileNameFromServiceName = (serviceNameArg: string) => {
|
||||||
return `${SmartDaemonSystemdManager.smartDaemonNamespace}_${serviceNameArg}.service`;
|
return `${SmartDaemonSystemdManager.smartDaemonNamespace}_${serviceNameArg}.service`;
|
||||||
};
|
};
|
||||||
@ -35,7 +35,7 @@ export class SmartDaemonSystemdManager {
|
|||||||
if (await this.smartsystem.env.isLinuxAsync()) {
|
if (await this.smartsystem.env.isLinuxAsync()) {
|
||||||
this.shouldExecute = true;
|
this.shouldExecute = true;
|
||||||
} else {
|
} else {
|
||||||
console.log('Smartdaemon can only be used on Linuc systems! Refusing to set up a service.');
|
console.log('Smartdaemon can only be used on Linux systems! Refusing to set up a service.');
|
||||||
this.shouldExecute = false;
|
this.shouldExecute = false;
|
||||||
}
|
}
|
||||||
return this.shouldExecute;
|
return this.shouldExecute;
|
||||||
|
Reference in New Issue
Block a user