Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d550318331 | |||
| 9fc71fcfee | |||
| 119f20915e | |||
| ce1fa6640b |
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartdaemon",
|
"name": "@pushrocks/smartdaemon",
|
||||||
"version": "1.0.17",
|
"version": "1.0.19",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartdaemon",
|
"name": "@pushrocks/smartdaemon",
|
||||||
"version": "1.0.17",
|
"version": "1.0.19",
|
||||||
"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",
|
||||||
|
|||||||
@@ -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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,8 +35,4 @@ export class SmartDaemon {
|
|||||||
await serviceToAdd.save();
|
await serviceToAdd.save();
|
||||||
return serviceToAdd;
|
return serviceToAdd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async init() {
|
|
||||||
await this.systemdManager.init();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,9 +79,6 @@ 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)}`
|
||||||
);
|
);
|
||||||
@@ -131,5 +128,11 @@ export class SmartDaemonSystemdManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async init() {}
|
public async reload() {
|
||||||
|
if (await this.checkElegibility()) {
|
||||||
|
await this.execute(
|
||||||
|
`systemctl daemon-reload`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ After=network.target
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
|
Environment=NODE_OPTIONS=--max_old_space_size=100
|
||||||
ExecStart=/bin/bash -c "cd ${serviceArg.workingDir} && ${serviceArg.command}"
|
ExecStart=/bin/bash -c "cd ${serviceArg.workingDir} && ${serviceArg.command}"
|
||||||
WorkingDirectory=${serviceArg.workingDir}
|
WorkingDirectory=${serviceArg.workingDir}
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|||||||
Reference in New Issue
Block a user