@push.rocks/smartdaemon 2.0.9 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.smartconfig.json +36 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/index.d.ts +1 -0
- package/dist_ts/index.js +2 -1
- package/dist_ts/smartdaemon.classes.service.d.ts +4 -0
- package/dist_ts/smartdaemon.classes.service.js +3 -4
- package/dist_ts/smartdaemon.classes.smartdaemon.d.ts +4 -1
- package/dist_ts/smartdaemon.classes.smartdaemon.js +3 -3
- package/dist_ts/smartdaemon.classes.systemdmanager.d.ts +6 -2
- package/dist_ts/smartdaemon.classes.systemdmanager.js +60 -7
- package/dist_ts/smartdaemon.classes.templatemanager.js +7 -4
- package/dist_ts/smartdaemon.plugins.d.ts +2 -2
- package/dist_ts/smartdaemon.plugins.js +3 -3
- package/license +4 -3
- package/npmextra.json +14 -8
- package/package.json +41 -34
- package/readme.md +371 -56
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/index.ts +1 -0
- package/ts/smartdaemon.classes.service.ts +12 -9
- package/ts/smartdaemon.classes.smartdaemon.ts +6 -2
- package/ts/smartdaemon.classes.systemdmanager.ts +64 -14
- package/ts/smartdaemon.classes.templatemanager.ts +6 -3
- package/ts/smartdaemon.plugins.ts +2 -2
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@git.zone/cli": {
|
|
3
|
+
"projectType": "npm",
|
|
4
|
+
"module": {
|
|
5
|
+
"githost": "code.foss.global",
|
|
6
|
+
"gitscope": "push.rocks",
|
|
7
|
+
"gitrepo": "smartdaemon",
|
|
8
|
+
"description": "Start scripts as long running daemons and manage them.",
|
|
9
|
+
"npmPackagename": "@push.rocks/smartdaemon",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"daemon",
|
|
13
|
+
"service management",
|
|
14
|
+
"Linux systemd",
|
|
15
|
+
"process management",
|
|
16
|
+
"Node.js",
|
|
17
|
+
"system administration",
|
|
18
|
+
"background services"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"release": {
|
|
22
|
+
"registries": [
|
|
23
|
+
"https://verdaccio.lossless.digital",
|
|
24
|
+
"https://registry.npmjs.org"
|
|
25
|
+
],
|
|
26
|
+
"accessLevel": "public"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"@git.zone/tsdoc": {
|
|
30
|
+
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
|
31
|
+
},
|
|
32
|
+
"@ship.zone/szci": {
|
|
33
|
+
"npmGlobalTools": [],
|
|
34
|
+
"npmRegistryUrl": "registry.npmjs.org"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@push.rocks/smartdaemon',
|
|
6
|
-
version: '2.
|
|
6
|
+
version: '2.1.1',
|
|
7
7
|
description: 'Start scripts as long running daemons and manage them.'
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx5QkFBeUI7SUFDL0IsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLHdEQUF3RDtDQUN0RSxDQUFBIn0=
|
package/dist_ts/index.d.ts
CHANGED
package/dist_ts/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export * from './smartdaemon.classes.smartdaemon.js';
|
|
2
|
-
|
|
2
|
+
export * from './smartdaemon.classes.service.js';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHNDQUFzQyxDQUFDO0FBQ3JELGNBQWMsa0NBQWtDLENBQUMifQ==
|
|
@@ -5,6 +5,8 @@ export interface ISmartDaemonServiceConstructorOptions {
|
|
|
5
5
|
command: string;
|
|
6
6
|
workingDir: string;
|
|
7
7
|
version: string;
|
|
8
|
+
user?: string;
|
|
9
|
+
group?: string;
|
|
8
10
|
}
|
|
9
11
|
/**
|
|
10
12
|
* represents a service that is being spawned by SmartDaemon
|
|
@@ -18,6 +20,8 @@ export declare class SmartDaemonService implements ISmartDaemonServiceConstructo
|
|
|
18
20
|
command: string;
|
|
19
21
|
workingDir: string;
|
|
20
22
|
description: string;
|
|
23
|
+
user?: string;
|
|
24
|
+
group?: string;
|
|
21
25
|
smartdaemonRef: SmartDaemon;
|
|
22
26
|
constructor(smartdaemonRegfArg: SmartDaemon);
|
|
23
27
|
/**
|
|
@@ -7,9 +7,8 @@ import { SmartDaemon } from './smartdaemon.classes.smartdaemon.js';
|
|
|
7
7
|
export class SmartDaemonService {
|
|
8
8
|
static async createFromOptions(smartdaemonRef, optionsArg) {
|
|
9
9
|
const service = new SmartDaemonService(smartdaemonRef);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
10
|
+
Object.assign(service, optionsArg);
|
|
11
|
+
service.options = optionsArg;
|
|
13
12
|
return service;
|
|
14
13
|
}
|
|
15
14
|
constructor(smartdaemonRegfArg) {
|
|
@@ -54,4 +53,4 @@ export class SmartDaemonService {
|
|
|
54
53
|
await this.smartdaemonRef.systemdManager.reload();
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
56
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYWVtb24uY2xhc3Nlcy5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRkYWVtb24uY2xhc3Nlcy5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxPQUFPLE1BQU0sMEJBQTBCLENBQUM7QUFDcEQsT0FBTyxLQUFLLEtBQUssTUFBTSx3QkFBd0IsQ0FBQztBQUNoRCxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0sc0NBQXNDLENBQUM7QUFZbkU7O0dBRUc7QUFDSCxNQUFNLE9BQU8sa0JBQWtCO0lBQ3RCLE1BQU0sQ0FBQyxLQUFLLENBQUMsaUJBQWlCLENBQ25DLGNBQTJCLEVBQzNCLFVBQWlEO1FBRWpELE1BQU0sT0FBTyxHQUFHLElBQUksa0JBQWtCLENBQUMsY0FBYyxDQUFDLENBQUM7UUFDdkQsTUFBTSxDQUFDLE1BQU0sQ0FB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0FBYyxDQUFDLGFBQWEsQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUMvRCxDQUFDO0lBRU0sS0FBSyxDQUFDLE1BQU07UUFDakIsTUFBTSxJQUFJLENBQUMsY0FBYyxDQUFDLGNBQWMsQ0FBQyxNQUFNLEVBQUUsQ0FBQztJQUNwRCxDQUFDO0NBQ0YifQ==
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { SmartDaemonTemplateManager } from './smartdaemon.classes.templatemanager.js';
|
|
2
2
|
import { type ISmartDaemonServiceConstructorOptions, SmartDaemonService } from './smartdaemon.classes.service.js';
|
|
3
3
|
import { SmartDaemonSystemdManager } from './smartdaemon.classes.systemdmanager.js';
|
|
4
|
+
export interface ISmartDaemonOptions {
|
|
5
|
+
sudoPassword?: string;
|
|
6
|
+
}
|
|
4
7
|
export declare class SmartDaemon {
|
|
5
8
|
templateManager: SmartDaemonTemplateManager;
|
|
6
9
|
systemdManager: SmartDaemonSystemdManager;
|
|
7
|
-
constructor();
|
|
10
|
+
constructor(optionsArg?: ISmartDaemonOptions);
|
|
8
11
|
/**
|
|
9
12
|
* adds a service
|
|
10
13
|
* @param nameArg
|
|
@@ -3,9 +3,9 @@ import { SmartDaemonTemplateManager } from './smartdaemon.classes.templatemanage
|
|
|
3
3
|
import { SmartDaemonService, } from './smartdaemon.classes.service.js';
|
|
4
4
|
import { SmartDaemonSystemdManager } from './smartdaemon.classes.systemdmanager.js';
|
|
5
5
|
export class SmartDaemon {
|
|
6
|
-
constructor() {
|
|
6
|
+
constructor(optionsArg) {
|
|
7
7
|
this.templateManager = new SmartDaemonTemplateManager(this);
|
|
8
|
-
this.systemdManager = new SmartDaemonSystemdManager(this);
|
|
8
|
+
this.systemdManager = new SmartDaemonSystemdManager(this, optionsArg?.sudoPassword);
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* adds a service
|
|
@@ -30,4 +30,4 @@ export class SmartDaemon {
|
|
|
30
30
|
return serviceToAdd;
|
|
31
31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QUksS0FBSyxVQUFVLENBQUMsSUFBSSxDQUFDO1FBQzdDLENBQUMsQ0FBQyxDQUFDO1FBQ0gsSUFBSSxDQUFDLGVBQWUsRUFBRSxDQUFDO1lBQ3JCLFlBQVksR0FBRyxNQUFNLGtCQUFrQixDQUFDLGlCQUFpQixDQUFDLElBQUksRUFBRSxVQUFVLENBQUMsQ0FBQztRQUM5RSxDQUFDO2FBQU0sQ0FBQztZQUNOLFlBQVksR0FBRyxlQUFlLENBQUM7WUFDL0IsTUFBTSxDQUFDLE1BQU0sQ0FBQyxZQUFZLEVBQUUsVUFBVSxDQUFDLENBQUM7UUFDMUMsQ0FBQztRQUNELE1BQU0sWUFBWSxDQUFDLElBQUksRUFBRSxDQUFDO1FBQzFCLE9BQU8sWUFBWSxDQUFDO0lBQ3RCLENBQUM7Q0FDRiJ9
|
|
@@ -9,10 +9,14 @@ export declare class SmartDaemonSystemdManager {
|
|
|
9
9
|
smartdaemonRef: SmartDaemon;
|
|
10
10
|
smartshellInstance: plugins.smartshell.Smartshell;
|
|
11
11
|
smartsystem: plugins.smartsystem.Smartsystem;
|
|
12
|
+
smartFs: plugins.smartfs.SmartFs;
|
|
12
13
|
shouldExecute: boolean;
|
|
13
|
-
|
|
14
|
+
isRoot: boolean;
|
|
15
|
+
sudoPassword?: string;
|
|
16
|
+
constructor(smartdaemonRefArg: SmartDaemon, sudoPasswordArg?: string);
|
|
17
|
+
private checkIsRoot;
|
|
14
18
|
checkElegibility(): Promise<boolean>;
|
|
15
|
-
execute(commandArg: string): Promise<
|
|
19
|
+
execute(commandArg: string): Promise<plugins.smartshell.IExecResult | undefined>;
|
|
16
20
|
/**
|
|
17
21
|
* gets all services that are already present
|
|
18
22
|
*/
|
|
@@ -14,13 +14,27 @@ export class SmartDaemonSystemdManager {
|
|
|
14
14
|
static createFilePathFromServiceName(serviceNameArg) {
|
|
15
15
|
return plugins.path.join(paths.systemdDir, SmartDaemonSystemdManager.createFileNameFromServiceName(serviceNameArg));
|
|
16
16
|
}
|
|
17
|
-
constructor(smartdaemonRefArg) {
|
|
17
|
+
constructor(smartdaemonRefArg, sudoPasswordArg) {
|
|
18
18
|
this.shouldExecute = false;
|
|
19
|
+
this.isRoot = false;
|
|
19
20
|
this.smartdaemonRef = smartdaemonRefArg;
|
|
20
21
|
this.smartshellInstance = new plugins.smartshell.Smartshell({
|
|
21
22
|
executor: 'bash',
|
|
22
23
|
});
|
|
23
24
|
this.smartsystem = new plugins.smartsystem.Smartsystem();
|
|
25
|
+
this.smartFs = new plugins.smartfs.SmartFs(new plugins.smartfs.SmartFsProviderNode());
|
|
26
|
+
this.sudoPassword = sudoPasswordArg;
|
|
27
|
+
// Check if we're running as root
|
|
28
|
+
this.checkIsRoot().then(isRoot => {
|
|
29
|
+
this.isRoot = isRoot;
|
|
30
|
+
if (!isRoot) {
|
|
31
|
+
console.log('Not running as root. Sudo will be used for privileged operations.');
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async checkIsRoot() {
|
|
36
|
+
const result = await this.smartshellInstance.exec('id -u');
|
|
37
|
+
return result.stdout.trim() === '0';
|
|
24
38
|
}
|
|
25
39
|
async checkElegibility() {
|
|
26
40
|
if (await this.smartsystem.env.isLinuxAsync()) {
|
|
@@ -34,7 +48,27 @@ export class SmartDaemonSystemdManager {
|
|
|
34
48
|
}
|
|
35
49
|
async execute(commandArg) {
|
|
36
50
|
if (await this.checkElegibility()) {
|
|
37
|
-
|
|
51
|
+
// Only use sudo if we're not root and command doesn't already have sudo
|
|
52
|
+
if (!this.isRoot && !commandArg.startsWith('sudo')) {
|
|
53
|
+
commandArg = `sudo ${commandArg}`;
|
|
54
|
+
if (this.sudoPassword) {
|
|
55
|
+
// Use interactive PTY mode for password input
|
|
56
|
+
const interactiveExec = await this.smartshellInstance.execInteractiveControlPty(commandArg);
|
|
57
|
+
await interactiveExec.sendLine(this.sudoPassword);
|
|
58
|
+
const result = await interactiveExec.finalPromise;
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Execute command (with or without sudo)
|
|
63
|
+
try {
|
|
64
|
+
await this.smartshellInstance.exec(commandArg);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
if (!this.isRoot && error instanceof Error && error.message.includes('authentication')) {
|
|
68
|
+
throw new Error('Sudo authentication failed. Please configure passwordless sudo or provide a sudo password.');
|
|
69
|
+
}
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
38
72
|
}
|
|
39
73
|
}
|
|
40
74
|
/**
|
|
@@ -46,9 +80,10 @@ export class SmartDaemonSystemdManager {
|
|
|
46
80
|
const smartfmInstance = new plugins.smartfm.Smartfm({
|
|
47
81
|
fmType: 'yaml',
|
|
48
82
|
});
|
|
49
|
-
const availableServices = await
|
|
83
|
+
const availableServices = await this.smartFs.directory(paths.systemdDir).filter('smartdaemon_*.service').list();
|
|
50
84
|
for (const serviceFile of availableServices) {
|
|
51
|
-
const
|
|
85
|
+
const serviceFileContent = await this.smartFs.file(serviceFile.path).encoding('utf8').read();
|
|
86
|
+
const data = smartfmInstance.parseFromComments('# ', serviceFileContent.toString())
|
|
52
87
|
.data;
|
|
53
88
|
const service = await SmartDaemonService.createFromOptions(this.smartdaemonRef, data);
|
|
54
89
|
service.alreadyExists = true;
|
|
@@ -69,12 +104,30 @@ export class SmartDaemonSystemdManager {
|
|
|
69
104
|
}
|
|
70
105
|
async saveService(serviceArg) {
|
|
71
106
|
if (await this.checkElegibility()) {
|
|
72
|
-
|
|
107
|
+
const content = this.smartdaemonRef.templateManager.generateUnitFileForService(serviceArg);
|
|
108
|
+
const targetPath = SmartDaemonSystemdManager.createFilePathFromServiceName(serviceArg.name);
|
|
109
|
+
if (this.isRoot) {
|
|
110
|
+
// Direct write when running as root
|
|
111
|
+
await this.smartFs.file(targetPath).encoding('utf8').mode(0o644).write(content);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
// Use sudo to write when not root
|
|
115
|
+
const tempPath = `/tmp/smartdaemon_${serviceArg.name}.service`;
|
|
116
|
+
await this.smartFs.file(tempPath).encoding('utf8').mode(0o644).write(content);
|
|
117
|
+
await this.execute(`mv ${tempPath} ${targetPath}`); // execute() will add sudo
|
|
118
|
+
await this.execute(`chmod 644 ${targetPath}`); // execute() will add sudo
|
|
119
|
+
}
|
|
73
120
|
}
|
|
74
121
|
}
|
|
75
122
|
async deleteService(serviceArg) {
|
|
76
123
|
if (await this.checkElegibility()) {
|
|
77
|
-
|
|
124
|
+
const filePath = SmartDaemonSystemdManager.createFilePathFromServiceName(serviceArg.name);
|
|
125
|
+
if (this.isRoot) {
|
|
126
|
+
await this.smartFs.file(filePath).delete();
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
await this.execute(`rm ${filePath}`); // execute() will add sudo
|
|
130
|
+
}
|
|
78
131
|
}
|
|
79
132
|
}
|
|
80
133
|
async enableService(serviceArg) {
|
|
@@ -97,4 +150,4 @@ export class SmartDaemonSystemdManager {
|
|
|
97
150
|
}
|
|
98
151
|
}
|
|
99
152
|
}
|
|
100
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
153
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYWVtb24uY2xhc3Nlcy5zeXN0ZW1kbWFuYWdlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0ZGFlbW9uLmNsYXNzZXMuc3lzdGVtZG1hbmFnZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLE9BQU8sTUFBTSwwQkFBMEIsQ0FBQztBQUNwRCxPQUFPLEtBQUssS0FBSyxNQUFNLHdCQUF3QixDQUFDO0FBQ2hELE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxzQ0FBc0MsQ0FBQztBQUNuRSxPQUFPLEVBRUwsa0JBQWtCLEdBQ25CLE1BQU0sa0N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
2
|
import { SmartDaemonService } from './smartdaemon.classes.service.js';
|
|
4
3
|
export class SmartDaemonTemplateManager {
|
|
@@ -9,7 +8,9 @@ export class SmartDaemonTemplateManager {
|
|
|
9
8
|
# version: ${serviceArg.version}
|
|
10
9
|
# description: ${serviceArg.description}
|
|
11
10
|
# command: ${serviceArg.command}
|
|
12
|
-
# workingDir: ${serviceArg.workingDir}
|
|
11
|
+
# workingDir: ${serviceArg.workingDir}${serviceArg.user ? `
|
|
12
|
+
# user: ${serviceArg.user}` : ''}${serviceArg.group ? `
|
|
13
|
+
# group: ${serviceArg.group}` : ''}
|
|
13
14
|
# ---
|
|
14
15
|
[Unit]
|
|
15
16
|
Description=${serviceArg.description}
|
|
@@ -17,7 +18,9 @@ Requires=network.target
|
|
|
17
18
|
After=network.target
|
|
18
19
|
|
|
19
20
|
[Service]
|
|
20
|
-
Type=simple
|
|
21
|
+
Type=simple${serviceArg.user ? `
|
|
22
|
+
User=${serviceArg.user}` : ''}${serviceArg.group ? `
|
|
23
|
+
Group=${serviceArg.group}` : ''}
|
|
21
24
|
Environment=NODE_OPTIONS="--max_old_space_size=100"
|
|
22
25
|
ExecStart=/bin/bash -c "cd ${serviceArg.workingDir} && ${serviceArg.command}"
|
|
23
26
|
WorkingDirectory=${serviceArg.workingDir}
|
|
@@ -35,4 +38,4 @@ WantedBy=multi-user.target
|
|
|
35
38
|
this.smartdaemonRef = smartdaemonRefArg;
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
41
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYWVtb24uY2xhc3Nlcy50ZW1wbGF0ZW1hbmFnZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGRhZW1vbi5jbGFzc2VzLnRlbXBsYXRlbWFuYWdlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFB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NGIn0=
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
2
|
export { path };
|
|
3
3
|
import * as lik from '@push.rocks/lik';
|
|
4
|
-
import * as smartfile from '@push.rocks/smartfile';
|
|
5
4
|
import * as smartfm from '@push.rocks/smartfm';
|
|
5
|
+
import * as smartfs from '@push.rocks/smartfs';
|
|
6
6
|
import * as smartlog from '@push.rocks/smartlog';
|
|
7
7
|
import * as smartlogDestinationLocal from '@push.rocks/smartlog-destination-local';
|
|
8
8
|
import * as smartpath from '@push.rocks/smartpath';
|
|
9
9
|
import * as smartshell from '@push.rocks/smartshell';
|
|
10
10
|
import * as smartsystem from '@push.rocks/smartsystem';
|
|
11
|
-
export { lik,
|
|
11
|
+
export { lik, smartfm, smartfs, smartlog, smartlogDestinationLocal, smartpath, smartshell, smartsystem, };
|
|
@@ -3,13 +3,13 @@ import * as path from 'path';
|
|
|
3
3
|
export { path };
|
|
4
4
|
// @pushrocks scope
|
|
5
5
|
import * as lik from '@push.rocks/lik';
|
|
6
|
-
import * as smartfile from '@push.rocks/smartfile';
|
|
7
6
|
import * as smartfm from '@push.rocks/smartfm';
|
|
7
|
+
import * as smartfs from '@push.rocks/smartfs';
|
|
8
8
|
import * as smartlog from '@push.rocks/smartlog';
|
|
9
9
|
import * as smartlogDestinationLocal from '@push.rocks/smartlog-destination-local';
|
|
10
10
|
import * as smartpath from '@push.rocks/smartpath';
|
|
11
11
|
import * as smartshell from '@push.rocks/smartshell';
|
|
12
12
|
import * as smartsystem from '@push.rocks/smartsystem';
|
|
13
|
-
export { lik,
|
|
13
|
+
export { lik, smartfm, smartfs, smartlog, smartlogDestinationLocal, smartpath, smartshell, smartsystem, };
|
|
14
14
|
// third party
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYWVtb24ucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0ZGFlbW9uLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsb0JBQW9CO0FBQ3BCLE9BQU8sS0FBSyxJQUFJLE1BQU0sTUFBTSxDQUFDO0FBRTdCLE9BQU8sRUFBRSxJQUFJLEVBQUUsQ0FBQztBQUVoQixtQkFBbUI7QUFDbkIsT0FBTyxLQUFLLEdBQUcsTUFBTSxpQkFBaUIsQ0FBQztBQUN2QyxPQUFPLEtBQUssT0FBTyxNQUFNLHFCQUFxQixDQUFDO0FBQy9DLE9BQU8sS0FBSyxPQUFPLE1BQU0scUJBQXFCLENBQUM7QUFDL0MsT0FBTyxLQUFLLFFBQVEsTUFBTSxzQkFBc0IsQ0FBQztBQUNqRCxPQUFPLEtBQUssd0JBQXdCLE1BQU0sd0NBQXdDLENBQUM7QUFDbkYsT0FBTyxLQUFLLFNBQVMsTUFBTSx1QkFBdUIsQ0FBQztBQUNuRCxPQUFPLEtBQUssVUFBVSxNQUFNLHdCQUF3QixDQUFDO0FBQ3JELE9BQU8sS0FBSyxXQUFXLE1BQU0seUJBQXlCLENBQUM7QUFFdkQsT0FBTyxFQUNMLEdBQUcsRUFDSCxPQUFPLEVBQ1AsT0FBTyxFQUNQLFFBQVEsRUFDUix3QkFBd0IsRUFDeEIsU0FBUyxFQUNULFVBQVUsRUFDVixXQUFXLEdBQ1osQ0FBQztBQUVGLGNBQWMifQ==
|
package/license
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Task Venture Capital GmbH
|
|
3
4
|
|
|
4
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -17,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
17
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/npmextra.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"@git.zone/cli": {
|
|
3
3
|
"projectType": "npm",
|
|
4
4
|
"module": {
|
|
5
5
|
"githost": "code.foss.global",
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
"description": "Start scripts as long running daemons and manage them.",
|
|
9
9
|
"npmPackagename": "@push.rocks/smartdaemon",
|
|
10
10
|
"license": "MIT",
|
|
11
|
-
"projectDomain": "push.rocks",
|
|
12
11
|
"keywords": [
|
|
13
12
|
"daemon",
|
|
14
13
|
"service management",
|
|
@@ -18,13 +17,20 @@
|
|
|
18
17
|
"system administration",
|
|
19
18
|
"background services"
|
|
20
19
|
]
|
|
20
|
+
},
|
|
21
|
+
"release": {
|
|
22
|
+
"registries": [
|
|
23
|
+
"https://verdaccio.lossless.digital",
|
|
24
|
+
"https://registry.npmjs.org"
|
|
25
|
+
],
|
|
26
|
+
"accessLevel": "public"
|
|
21
27
|
}
|
|
22
28
|
},
|
|
23
|
-
"
|
|
24
|
-
"npmGlobalTools": [],
|
|
25
|
-
"npmAccessLevel": "public"
|
|
26
|
-
},
|
|
27
|
-
"tsdoc": {
|
|
29
|
+
"@git.zone/tsdoc": {
|
|
28
30
|
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
|
31
|
+
},
|
|
32
|
+
"@ship.zone/szci": {
|
|
33
|
+
"npmGlobalTools": [],
|
|
34
|
+
"npmRegistryUrl": "registry.npmjs.org"
|
|
29
35
|
}
|
|
30
|
-
}
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,27 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@push.rocks/smartdaemon",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Start scripts as long running daemons and manage them.",
|
|
6
6
|
"main": "dist_ts/index.js",
|
|
7
7
|
"typings": "dist_ts/index.d.ts",
|
|
8
|
-
"
|
|
8
|
+
"type": "module",
|
|
9
|
+
"author": "Task Venture Capital GmbH <hello@task.vc>",
|
|
9
10
|
"license": "MIT",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"test": "tstest test/ --verbose --timeout 60",
|
|
13
|
+
"build": "tsbuild --web",
|
|
14
|
+
"format": "gitzone format",
|
|
15
|
+
"buildDocs": "tsdoc"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://code.foss.global/push.rocks/smartdaemon.git"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"daemon",
|
|
23
|
+
"service management",
|
|
24
|
+
"Linux systemd",
|
|
25
|
+
"process management",
|
|
26
|
+
"Node.js",
|
|
27
|
+
"system administration",
|
|
28
|
+
"background services"
|
|
29
|
+
],
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://gitlab.com/push.rocks/smartdaemon/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://code.foss.global/push.rocks/smartdaemon",
|
|
10
34
|
"devDependencies": {
|
|
11
|
-
"@git.zone/tsbuild": "^
|
|
12
|
-
"@git.zone/tsrun": "^
|
|
13
|
-
"@git.zone/tstest": "^
|
|
14
|
-
"@types/node": "^
|
|
35
|
+
"@git.zone/tsbuild": "^4.4.0",
|
|
36
|
+
"@git.zone/tsrun": "^2.0.3",
|
|
37
|
+
"@git.zone/tstest": "^3.6.3",
|
|
38
|
+
"@types/node": "^25.6.0"
|
|
15
39
|
},
|
|
16
40
|
"dependencies": {
|
|
17
|
-
"@push.rocks/lik": "^6.
|
|
18
|
-
"@push.rocks/
|
|
19
|
-
"@push.rocks/
|
|
20
|
-
"@push.rocks/smartlog": "^3.
|
|
21
|
-
"@push.rocks/smartlog-destination-local": "^9.0.
|
|
41
|
+
"@push.rocks/lik": "^6.4.1",
|
|
42
|
+
"@push.rocks/smartfm": "^2.2.2",
|
|
43
|
+
"@push.rocks/smartfs": "^1.5.1",
|
|
44
|
+
"@push.rocks/smartlog": "^3.2.2",
|
|
45
|
+
"@push.rocks/smartlog-destination-local": "^9.0.2",
|
|
22
46
|
"@push.rocks/smartpath": "^6.0.0",
|
|
23
|
-
"@push.rocks/smartshell": "^3.3.
|
|
24
|
-
"@push.rocks/smartsystem": "^3.0.
|
|
47
|
+
"@push.rocks/smartshell": "^3.3.8",
|
|
48
|
+
"@push.rocks/smartsystem": "^3.0.8"
|
|
25
49
|
},
|
|
26
50
|
"files": [
|
|
27
51
|
"ts/**/*",
|
|
@@ -32,30 +56,13 @@
|
|
|
32
56
|
"dist_ts_web/**/*",
|
|
33
57
|
"assets/**/*",
|
|
34
58
|
"cli.js",
|
|
59
|
+
".smartconfig.json",
|
|
60
|
+
"license",
|
|
35
61
|
"npmextra.json",
|
|
36
62
|
"readme.md"
|
|
37
63
|
],
|
|
38
64
|
"browserslist": [
|
|
39
65
|
"last 1 chrome versions"
|
|
40
66
|
],
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
"daemon",
|
|
44
|
-
"service management",
|
|
45
|
-
"Linux systemd",
|
|
46
|
-
"process management",
|
|
47
|
-
"Node.js",
|
|
48
|
-
"system administration",
|
|
49
|
-
"background services"
|
|
50
|
-
],
|
|
51
|
-
"homepage": "https://code.foss.global/push.rocks/smartdaemon",
|
|
52
|
-
"repository": {
|
|
53
|
-
"type": "git",
|
|
54
|
-
"url": "https://code.foss.global/push.rocks/smartdaemon.git"
|
|
55
|
-
},
|
|
56
|
-
"scripts": {
|
|
57
|
-
"test": "(tstest test/ --verbose --logfile --timeout 60)",
|
|
58
|
-
"build": "(tsbuild --web --allowimplicitany)",
|
|
59
|
-
"buildDocs": "tsdoc"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
67
|
+
"packageManager": "pnpm@10.28.2"
|
|
68
|
+
}
|
package/readme.md
CHANGED
|
@@ -1,96 +1,411 @@
|
|
|
1
|
-
# @push.rocks/smartdaemon
|
|
2
|
-
|
|
1
|
+
# @push.rocks/smartdaemon 🚀
|
|
2
|
+
**Turn your Node.js scripts into production-ready system daemons**
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
[](https://www.npmjs.com/package/@push.rocks/smartdaemon)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
> Seamlessly manage long-running processes, background services, and system daemons with smart root detection, automatic privilege escalation, and systemd integration.
|
|
8
|
+
|
|
9
|
+
## 🎯 What is SmartDaemon?
|
|
10
|
+
|
|
11
|
+
`@push.rocks/smartdaemon` is your Swiss Army knife for turning Node.js applications into bulletproof system services. Whether you're deploying microservices, running scheduled tasks, or managing background workers, SmartDaemon handles the complex stuff so you can focus on your business logic.
|
|
12
|
+
|
|
13
|
+
### ✨ Key Features
|
|
14
|
+
|
|
15
|
+
- 🔐 **Smart Privilege Management**: Automatically detects root status and handles sudo operations seamlessly
|
|
16
|
+
- 👤 **User/Group Control**: Run services under specific users for enhanced security
|
|
17
|
+
- 🔄 **Systemd Integration**: Full Linux systemd support for production-grade service management
|
|
18
|
+
- 🛡️ **Auto-Recovery**: Built-in service restart on failure
|
|
19
|
+
- 📝 **Declarative Service Definitions**: Simple, clear service configuration
|
|
20
|
+
- 🔌 **Interactive & Non-Interactive Modes**: Support for both passwordless sudo and interactive authentication
|
|
21
|
+
- 🎛️ **Complete Lifecycle Management**: Start, stop, enable, disable, and reload services with ease
|
|
22
|
+
|
|
23
|
+
## 📦 Installation
|
|
6
24
|
|
|
7
25
|
```bash
|
|
26
|
+
# Using npm
|
|
8
27
|
npm install @push.rocks/smartdaemon --save
|
|
9
|
-
```
|
|
10
|
-
This will add `@push.rocks/smartdaemon` to your project's dependencies.
|
|
11
28
|
|
|
12
|
-
|
|
29
|
+
# Using pnpm (recommended)
|
|
30
|
+
pnpm add @push.rocks/smartdaemon
|
|
13
31
|
|
|
14
|
-
|
|
32
|
+
# Using yarn
|
|
33
|
+
yarn add @push.rocks/smartdaemon
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 🚀 Quick Start
|
|
15
37
|
|
|
16
|
-
###
|
|
17
|
-
First, ensure you import `SmartDaemon` from the package in your TypeScript files:
|
|
38
|
+
### Basic Usage
|
|
18
39
|
|
|
19
40
|
```typescript
|
|
20
41
|
import { SmartDaemon } from '@push.rocks/smartdaemon';
|
|
42
|
+
|
|
43
|
+
// Initialize SmartDaemon
|
|
44
|
+
const daemon = new SmartDaemon();
|
|
45
|
+
|
|
46
|
+
// Create and enable a service
|
|
47
|
+
const myService = await daemon.addService({
|
|
48
|
+
name: 'my-api-server',
|
|
49
|
+
description: 'My awesome API server',
|
|
50
|
+
command: 'node server.js',
|
|
51
|
+
workingDir: '/opt/myapp',
|
|
52
|
+
version: '1.0.0'
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Enable and start the service
|
|
56
|
+
await myService.enable(); // Creates systemd service file
|
|
57
|
+
await myService.start(); // Starts the service
|
|
21
58
|
```
|
|
22
59
|
|
|
23
|
-
###
|
|
24
|
-
|
|
60
|
+
### Running Services as Specific Users 👥
|
|
61
|
+
|
|
62
|
+
Security best practice: Never run services as root unless absolutely necessary!
|
|
25
63
|
|
|
26
64
|
```typescript
|
|
27
|
-
const
|
|
65
|
+
const webService = await daemon.addService({
|
|
66
|
+
name: 'web-server',
|
|
67
|
+
description: 'Production web server',
|
|
68
|
+
command: 'node app.js',
|
|
69
|
+
workingDir: '/var/www/app',
|
|
70
|
+
version: '2.1.0',
|
|
71
|
+
user: 'www-data', // Run as www-data user
|
|
72
|
+
group: 'www-data' // Run under www-data group
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
await webService.enable();
|
|
76
|
+
await webService.start();
|
|
28
77
|
```
|
|
29
78
|
|
|
30
|
-
|
|
31
|
-
To manage a daemon, you first need to define it as a service. A service in `smartdaemon` is essentially a description of the daemon process you want to manage — including how it should be started, where it should run, and other operational metadata.
|
|
79
|
+
## 🔐 Smart Privilege Escalation
|
|
32
80
|
|
|
33
|
-
|
|
81
|
+
SmartDaemon intelligently handles privilege escalation based on your execution context:
|
|
82
|
+
|
|
83
|
+
### Automatic Root Detection
|
|
34
84
|
|
|
35
85
|
```typescript
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
86
|
+
// SmartDaemon automatically detects if running as root
|
|
87
|
+
const daemon = new SmartDaemon();
|
|
88
|
+
|
|
89
|
+
// If running as regular user, sudo will be used automatically
|
|
90
|
+
// If running as root, commands execute directly
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### With Sudo Password
|
|
94
|
+
|
|
95
|
+
If you're not running as root and don't have passwordless sudo configured:
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
const daemon = new SmartDaemon({
|
|
99
|
+
sudoPassword: 'your-sudo-password' // Will be used for privilege escalation
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// All privileged operations will now use the provided password
|
|
103
|
+
const service = await daemon.addService({
|
|
104
|
+
name: 'privileged-service',
|
|
105
|
+
description: 'Service requiring root privileges',
|
|
106
|
+
command: 'node admin-task.js',
|
|
107
|
+
workingDir: '/opt/admin',
|
|
108
|
+
version: '1.0.0'
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
await service.enable(); // Automatically uses sudo with password
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Passwordless Sudo (Recommended for Production)
|
|
115
|
+
|
|
116
|
+
For production environments, configure passwordless sudo for specific systemctl commands:
|
|
117
|
+
|
|
118
|
+
1. Create a sudoers file: `/etc/sudoers.d/smartdaemon`
|
|
119
|
+
2. Add the following content:
|
|
120
|
+
```bash
|
|
121
|
+
# Allow smartdaemon to manage services without password
|
|
122
|
+
yourusername ALL=(ALL) NOPASSWD: /usr/bin/systemctl start smartdaemon_*
|
|
123
|
+
yourusername ALL=(ALL) NOPASSWD: /usr/bin/systemctl stop smartdaemon_*
|
|
124
|
+
yourusername ALL=(ALL) NOPASSWD: /usr/bin/systemctl enable smartdaemon_*
|
|
125
|
+
yourusername ALL=(ALL) NOPASSWD: /usr/bin/systemctl disable smartdaemon_*
|
|
126
|
+
yourusername ALL=(ALL) NOPASSWD: /usr/bin/systemctl daemon-reload
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## 📚 Complete API
|
|
130
|
+
|
|
131
|
+
### SmartDaemon Class
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
interface ISmartDaemonOptions {
|
|
135
|
+
sudoPassword?: string; // Optional sudo password for privilege escalation
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
class SmartDaemon {
|
|
139
|
+
constructor(options?: ISmartDaemonOptions);
|
|
140
|
+
|
|
141
|
+
// Add a new service or update existing one
|
|
142
|
+
async addService(options: ISmartDaemonServiceOptions): Promise<SmartDaemonService>;
|
|
143
|
+
|
|
144
|
+
// Direct access to managers (advanced usage)
|
|
145
|
+
systemdManager: SmartDaemonSystemdManager;
|
|
146
|
+
templateManager: SmartDaemonTemplateManager;
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### SmartDaemonService Class
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
interface ISmartDaemonServiceOptions {
|
|
154
|
+
name: string; // Unique service identifier
|
|
155
|
+
description: string; // Human-readable description
|
|
156
|
+
command: string; // Command to execute
|
|
157
|
+
workingDir: string; // Working directory (absolute path)
|
|
158
|
+
version: string; // Service version
|
|
159
|
+
user?: string; // User to run service as (optional)
|
|
160
|
+
group?: string; // Group to run service as (optional)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
class SmartDaemonService {
|
|
164
|
+
// Lifecycle management
|
|
165
|
+
async enable(): Promise<void>; // Install and enable service
|
|
166
|
+
async disable(): Promise<void>; // Disable service
|
|
167
|
+
async start(): Promise<void>; // Start service
|
|
168
|
+
async stop(): Promise<void>; // Stop service
|
|
44
169
|
|
|
45
|
-
|
|
170
|
+
// Service management
|
|
171
|
+
async save(): Promise<void>; // Save service configuration
|
|
172
|
+
async delete(): Promise<void>; // Remove service
|
|
173
|
+
async reload(): Promise<void>; // Reload systemd daemon
|
|
46
174
|
}
|
|
47
|
-
addSampleService();
|
|
48
175
|
```
|
|
49
176
|
|
|
50
|
-
|
|
51
|
-
- `name`: Unique identifier for the service.
|
|
52
|
-
- `description`: A brief explanation of the service.
|
|
53
|
-
- `command`: The command that starts your daemon (e.g., node application, shell script).
|
|
54
|
-
- `workingDir`: The working directory from which the command will be executed.
|
|
55
|
-
- `version`: The version of your service. This can be used for your own versioning and tracking.
|
|
177
|
+
## 🎭 Real-World Examples
|
|
56
178
|
|
|
57
|
-
###
|
|
58
|
-
After adding and enabling a service, you can control it using the start and stop methods.
|
|
179
|
+
### Microservice Deployment
|
|
59
180
|
|
|
60
181
|
```typescript
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
182
|
+
import { SmartDaemon } from '@push.rocks/smartdaemon';
|
|
183
|
+
|
|
184
|
+
async function deployMicroservices() {
|
|
185
|
+
const daemon = new SmartDaemon();
|
|
186
|
+
|
|
187
|
+
// API Gateway
|
|
188
|
+
const apiGateway = await daemon.addService({
|
|
189
|
+
name: 'api-gateway',
|
|
190
|
+
description: 'API Gateway Service',
|
|
191
|
+
command: 'node --max-old-space-size=2048 gateway.js',
|
|
192
|
+
workingDir: '/opt/services/gateway',
|
|
193
|
+
version: '3.2.1',
|
|
194
|
+
user: 'apiuser',
|
|
195
|
+
group: 'apigroup'
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// Auth Service
|
|
199
|
+
const authService = await daemon.addService({
|
|
200
|
+
name: 'auth-service',
|
|
201
|
+
description: 'Authentication Service',
|
|
202
|
+
command: 'node auth-service.js',
|
|
203
|
+
workingDir: '/opt/services/auth',
|
|
204
|
+
version: '2.1.0',
|
|
205
|
+
user: 'authuser',
|
|
206
|
+
group: 'authgroup'
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// Database Sync Worker
|
|
210
|
+
const dbWorker = await daemon.addService({
|
|
211
|
+
name: 'db-sync-worker',
|
|
212
|
+
description: 'Database Synchronization Worker',
|
|
213
|
+
command: 'node workers/db-sync.js',
|
|
214
|
+
workingDir: '/opt/services/workers',
|
|
215
|
+
version: '1.5.3',
|
|
216
|
+
user: 'dbworker',
|
|
217
|
+
group: 'dbgroup'
|
|
218
|
+
});
|
|
64
219
|
|
|
65
|
-
//
|
|
66
|
-
|
|
220
|
+
// Enable and start all services
|
|
221
|
+
const services = [apiGateway, authService, dbWorker];
|
|
222
|
+
|
|
223
|
+
for (const service of services) {
|
|
224
|
+
await service.enable();
|
|
225
|
+
await service.start();
|
|
226
|
+
console.log(`✅ Service ${service.name} is running`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
deployMicroservices();
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Scheduled Task Runner
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
async function setupScheduledTasks() {
|
|
237
|
+
const daemon = new SmartDaemon();
|
|
238
|
+
|
|
239
|
+
// Backup service that runs every night
|
|
240
|
+
const backupService = await daemon.addService({
|
|
241
|
+
name: 'nightly-backup',
|
|
242
|
+
description: 'Nightly database backup service',
|
|
243
|
+
command: 'node --require dotenv/config backup-runner.js',
|
|
244
|
+
workingDir: '/opt/backup',
|
|
245
|
+
version: '1.0.0',
|
|
246
|
+
user: 'backup',
|
|
247
|
+
group: 'backup'
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
await backupService.enable();
|
|
251
|
+
await backupService.start();
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Development vs Production Setup
|
|
67
256
|
|
|
68
|
-
|
|
69
|
-
|
|
257
|
+
```typescript
|
|
258
|
+
import { SmartDaemon } from '@push.rocks/smartdaemon';
|
|
259
|
+
|
|
260
|
+
async function setupService(environment: 'development' | 'production') {
|
|
261
|
+
let daemonOptions = {};
|
|
262
|
+
|
|
263
|
+
if (environment === 'development') {
|
|
264
|
+
// In development, you might use sudo password
|
|
265
|
+
daemonOptions = {
|
|
266
|
+
sudoPassword: process.env.SUDO_PASSWORD
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
// In production, rely on passwordless sudo configuration
|
|
270
|
+
|
|
271
|
+
const daemon = new SmartDaemon(daemonOptions);
|
|
272
|
+
|
|
273
|
+
const service = await daemon.addService({
|
|
274
|
+
name: `app-${environment}`,
|
|
275
|
+
description: `Application ${environment} server`,
|
|
276
|
+
command: environment === 'production'
|
|
277
|
+
? 'node --production app.js'
|
|
278
|
+
: 'node --inspect app.js',
|
|
279
|
+
workingDir: '/opt/application',
|
|
280
|
+
version: '1.0.0',
|
|
281
|
+
user: environment === 'production' ? 'appuser' : process.env.USER,
|
|
282
|
+
group: environment === 'production' ? 'appgroup' : process.env.USER
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
await service.enable();
|
|
286
|
+
await service.start();
|
|
70
287
|
}
|
|
71
|
-
controlService();
|
|
72
288
|
```
|
|
73
289
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
290
|
+
## 🔧 Advanced Usage
|
|
291
|
+
|
|
292
|
+
### Direct SystemdManager Access
|
|
293
|
+
|
|
294
|
+
For advanced users who need fine-grained control:
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
const daemon = new SmartDaemon();
|
|
298
|
+
|
|
299
|
+
// Access the SystemdManager directly
|
|
300
|
+
const systemdManager = daemon.systemdManager;
|
|
301
|
+
|
|
302
|
+
// Check if running on a compatible system
|
|
303
|
+
const canRun = await systemdManager.checkElegibility();
|
|
304
|
+
|
|
305
|
+
// Get all existing SmartDaemon services
|
|
306
|
+
const existingServices = await systemdManager.getServices();
|
|
307
|
+
|
|
308
|
+
// Reload systemd daemon
|
|
309
|
+
await systemdManager.reload();
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Custom Service Templates
|
|
79
313
|
|
|
80
|
-
|
|
81
|
-
If you're operating on a Linux environment, `smartdaemon` can generate and control services using `systemd`. This integration allows for robust management capabilities, utilizing system-level features for daemon management.
|
|
314
|
+
Access the template manager for custom service file generation:
|
|
82
315
|
|
|
83
316
|
```typescript
|
|
84
|
-
|
|
85
|
-
|
|
317
|
+
const daemon = new SmartDaemon();
|
|
318
|
+
const template = daemon.templateManager.generateUnitFileForService(myService);
|
|
319
|
+
console.log(template); // View generated systemd unit file
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
## 🏗️ System Requirements
|
|
323
|
+
|
|
324
|
+
- **Operating System**: Linux with systemd (Ubuntu 16.04+, Debian 9+, CentOS 7+, RHEL 7+, Fedora, Arch, etc.)
|
|
325
|
+
- **Node.js**: Version 14.x or higher
|
|
326
|
+
- **Permissions**: Either root access or properly configured sudo
|
|
327
|
+
|
|
328
|
+
## ⚙️ Generated Systemd Service Files
|
|
329
|
+
|
|
330
|
+
SmartDaemon generates professional systemd unit files with:
|
|
331
|
+
- Automatic restart on failure
|
|
332
|
+
- Network target dependencies
|
|
333
|
+
- Proper working directory configuration
|
|
334
|
+
- User/Group assignment
|
|
335
|
+
- Resource limits configuration
|
|
336
|
+
- Syslog integration for logging
|
|
337
|
+
- Environment variable support
|
|
338
|
+
|
|
339
|
+
Example generated service file:
|
|
340
|
+
```ini
|
|
341
|
+
[Unit]
|
|
342
|
+
Description=My API Server
|
|
343
|
+
Requires=network.target
|
|
344
|
+
After=network.target
|
|
345
|
+
|
|
346
|
+
[Service]
|
|
347
|
+
Type=simple
|
|
348
|
+
User=www-data
|
|
349
|
+
Group=www-data
|
|
350
|
+
Environment=NODE_OPTIONS="--max_old_space_size=100"
|
|
351
|
+
ExecStart=/bin/bash -c "cd /opt/myapp && node server.js"
|
|
352
|
+
WorkingDirectory=/opt/myapp
|
|
353
|
+
Restart=always
|
|
354
|
+
RestartSec=10
|
|
355
|
+
LimitNOFILE=infinity
|
|
356
|
+
LimitCORE=infinity
|
|
357
|
+
StandardOutput=syslog
|
|
358
|
+
StandardError=syslog
|
|
359
|
+
|
|
360
|
+
[Install]
|
|
361
|
+
WantedBy=multi-user.target
|
|
86
362
|
```
|
|
87
363
|
|
|
88
|
-
|
|
89
|
-
|
|
364
|
+
## 🐛 Troubleshooting
|
|
365
|
+
|
|
366
|
+
### Permission Denied Errors
|
|
367
|
+
|
|
368
|
+
If you encounter "Interactive authentication required" errors:
|
|
369
|
+
|
|
370
|
+
1. **Option 1**: Run your application with sudo
|
|
371
|
+
```bash
|
|
372
|
+
sudo node your-app.js
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
2. **Option 2**: Configure passwordless sudo (recommended for production)
|
|
376
|
+
|
|
377
|
+
3. **Option 3**: Provide sudo password programmatically
|
|
378
|
+
```typescript
|
|
379
|
+
const daemon = new SmartDaemon({ sudoPassword: 'your-password' });
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### Service Not Found
|
|
383
|
+
|
|
384
|
+
If systemctl can't find your service:
|
|
385
|
+
- Check that the service was enabled: `await service.enable()`
|
|
386
|
+
- Verify the service name: Services are prefixed with `smartdaemon_`
|
|
387
|
+
- Reload systemd: `await service.reload()`
|
|
388
|
+
|
|
389
|
+
### Service Fails to Start
|
|
390
|
+
|
|
391
|
+
Check logs using:
|
|
392
|
+
```bash
|
|
393
|
+
journalctl -u smartdaemon_your-service-name -f
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
## 🔒 Security Best Practices
|
|
397
|
+
|
|
398
|
+
1. **Never run services as root** unless absolutely necessary
|
|
399
|
+
2. **Use dedicated service users** with minimal permissions
|
|
400
|
+
3. **Configure passwordless sudo** for production instead of storing passwords
|
|
401
|
+
4. **Limit sudo permissions** to only the specific systemctl commands needed
|
|
402
|
+
5. **Regular security audits** of your service configurations
|
|
90
403
|
|
|
91
|
-
|
|
404
|
+
## 🤝 Support
|
|
92
405
|
|
|
93
|
-
|
|
406
|
+
- 📧 Email: hello@task.vc
|
|
407
|
+
- 🐛 Issues: [GitHub Issues](https://code.foss.global/push.rocks/smartdaemon/issues)
|
|
408
|
+
- 📖 Documentation: [https://code.foss.global/push.rocks/smartdaemon](https://code.foss.global/push.rocks/smartdaemon)
|
|
94
409
|
|
|
95
410
|
## License and Legal Information
|
|
96
411
|
|
|
@@ -109,4 +424,4 @@ Registered at District court Bremen HRB 35230 HB, Germany
|
|
|
109
424
|
|
|
110
425
|
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
|
111
426
|
|
|
112
|
-
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
|
427
|
+
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
package/ts/00_commitinfo_data.ts
CHANGED
package/ts/index.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface ISmartDaemonServiceConstructorOptions {
|
|
|
8
8
|
command: string;
|
|
9
9
|
workingDir: string;
|
|
10
10
|
version: string;
|
|
11
|
+
user?: string;
|
|
12
|
+
group?: string;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
/**
|
|
@@ -19,20 +21,21 @@ export class SmartDaemonService implements ISmartDaemonServiceConstructorOptions
|
|
|
19
21
|
optionsArg: ISmartDaemonServiceConstructorOptions
|
|
20
22
|
) {
|
|
21
23
|
const service = new SmartDaemonService(smartdaemonRef);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
24
|
+
Object.assign(service, optionsArg);
|
|
25
|
+
service.options = optionsArg;
|
|
25
26
|
return service;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
public options
|
|
29
|
+
public options!: ISmartDaemonServiceConstructorOptions;
|
|
29
30
|
public alreadyExists = false;
|
|
30
31
|
|
|
31
|
-
public name
|
|
32
|
-
public version
|
|
33
|
-
public command
|
|
34
|
-
public workingDir
|
|
35
|
-
public description
|
|
32
|
+
public name!: string;
|
|
33
|
+
public version!: string;
|
|
34
|
+
public command!: string;
|
|
35
|
+
public workingDir!: string;
|
|
36
|
+
public description!: string;
|
|
37
|
+
public user?: string;
|
|
38
|
+
public group?: string;
|
|
36
39
|
|
|
37
40
|
public smartdaemonRef: SmartDaemon;
|
|
38
41
|
|
|
@@ -6,13 +6,17 @@ import {
|
|
|
6
6
|
} from './smartdaemon.classes.service.js';
|
|
7
7
|
import { SmartDaemonSystemdManager } from './smartdaemon.classes.systemdmanager.js';
|
|
8
8
|
|
|
9
|
+
export interface ISmartDaemonOptions {
|
|
10
|
+
sudoPassword?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
export class SmartDaemon {
|
|
10
14
|
public templateManager: SmartDaemonTemplateManager;
|
|
11
15
|
public systemdManager: SmartDaemonSystemdManager;
|
|
12
16
|
|
|
13
|
-
constructor() {
|
|
17
|
+
constructor(optionsArg?: ISmartDaemonOptions) {
|
|
14
18
|
this.templateManager = new SmartDaemonTemplateManager(this);
|
|
15
|
-
this.systemdManager = new SmartDaemonSystemdManager(this);
|
|
19
|
+
this.systemdManager = new SmartDaemonSystemdManager(this, optionsArg?.sudoPassword);
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
/**
|
|
@@ -29,15 +29,33 @@ export class SmartDaemonSystemdManager {
|
|
|
29
29
|
public smartdaemonRef: SmartDaemon;
|
|
30
30
|
public smartshellInstance: plugins.smartshell.Smartshell;
|
|
31
31
|
public smartsystem: plugins.smartsystem.Smartsystem;
|
|
32
|
+
public smartFs: plugins.smartfs.SmartFs;
|
|
32
33
|
|
|
33
34
|
public shouldExecute: boolean = false;
|
|
35
|
+
public isRoot: boolean = false;
|
|
36
|
+
public sudoPassword?: string;
|
|
34
37
|
|
|
35
|
-
constructor(smartdaemonRefArg: SmartDaemon) {
|
|
38
|
+
constructor(smartdaemonRefArg: SmartDaemon, sudoPasswordArg?: string) {
|
|
36
39
|
this.smartdaemonRef = smartdaemonRefArg;
|
|
37
40
|
this.smartshellInstance = new plugins.smartshell.Smartshell({
|
|
38
41
|
executor: 'bash',
|
|
39
42
|
});
|
|
40
43
|
this.smartsystem = new plugins.smartsystem.Smartsystem();
|
|
44
|
+
this.smartFs = new plugins.smartfs.SmartFs(new plugins.smartfs.SmartFsProviderNode());
|
|
45
|
+
this.sudoPassword = sudoPasswordArg;
|
|
46
|
+
|
|
47
|
+
// Check if we're running as root
|
|
48
|
+
this.checkIsRoot().then(isRoot => {
|
|
49
|
+
this.isRoot = isRoot;
|
|
50
|
+
if (!isRoot) {
|
|
51
|
+
console.log('Not running as root. Sudo will be used for privileged operations.');
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private async checkIsRoot(): Promise<boolean> {
|
|
57
|
+
const result = await this.smartshellInstance.exec('id -u');
|
|
58
|
+
return result.stdout.trim() === '0';
|
|
41
59
|
}
|
|
42
60
|
|
|
43
61
|
public async checkElegibility() {
|
|
@@ -52,7 +70,28 @@ export class SmartDaemonSystemdManager {
|
|
|
52
70
|
|
|
53
71
|
public async execute(commandArg: string) {
|
|
54
72
|
if (await this.checkElegibility()) {
|
|
55
|
-
|
|
73
|
+
// Only use sudo if we're not root and command doesn't already have sudo
|
|
74
|
+
if (!this.isRoot && !commandArg.startsWith('sudo')) {
|
|
75
|
+
commandArg = `sudo ${commandArg}`;
|
|
76
|
+
|
|
77
|
+
if (this.sudoPassword) {
|
|
78
|
+
// Use interactive PTY mode for password input
|
|
79
|
+
const interactiveExec = await this.smartshellInstance.execInteractiveControlPty(commandArg);
|
|
80
|
+
await interactiveExec.sendLine(this.sudoPassword);
|
|
81
|
+
const result = await interactiveExec.finalPromise;
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Execute command (with or without sudo)
|
|
87
|
+
try {
|
|
88
|
+
await this.smartshellInstance.exec(commandArg);
|
|
89
|
+
} catch (error) {
|
|
90
|
+
if (!this.isRoot && error instanceof Error && error.message.includes('authentication')) {
|
|
91
|
+
throw new Error('Sudo authentication failed. Please configure passwordless sudo or provide a sudo password.');
|
|
92
|
+
}
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
56
95
|
}
|
|
57
96
|
}
|
|
58
97
|
|
|
@@ -65,12 +104,10 @@ export class SmartDaemonSystemdManager {
|
|
|
65
104
|
const smartfmInstance = new plugins.smartfm.Smartfm({
|
|
66
105
|
fmType: 'yaml',
|
|
67
106
|
});
|
|
68
|
-
const availableServices = await
|
|
69
|
-
paths.systemdDir,
|
|
70
|
-
'smartdaemon_*.service'
|
|
71
|
-
);
|
|
107
|
+
const availableServices = await this.smartFs.directory(paths.systemdDir).filter('smartdaemon_*.service').list();
|
|
72
108
|
for (const serviceFile of availableServices) {
|
|
73
|
-
const
|
|
109
|
+
const serviceFileContent = await this.smartFs.file(serviceFile.path).encoding('utf8').read();
|
|
110
|
+
const data = smartfmInstance.parseFromComments('# ', serviceFileContent.toString())
|
|
74
111
|
.data as ISmartDaemonServiceConstructorOptions;
|
|
75
112
|
const service = await SmartDaemonService.createFromOptions(this.smartdaemonRef, data);
|
|
76
113
|
service.alreadyExists = true;
|
|
@@ -101,18 +138,31 @@ export class SmartDaemonSystemdManager {
|
|
|
101
138
|
|
|
102
139
|
public async saveService(serviceArg: SmartDaemonService) {
|
|
103
140
|
if (await this.checkElegibility()) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
)
|
|
141
|
+
const content = this.smartdaemonRef.templateManager.generateUnitFileForService(serviceArg);
|
|
142
|
+
const targetPath = SmartDaemonSystemdManager.createFilePathFromServiceName(serviceArg.name);
|
|
143
|
+
|
|
144
|
+
if (this.isRoot) {
|
|
145
|
+
// Direct write when running as root
|
|
146
|
+
await this.smartFs.file(targetPath).encoding('utf8').mode(0o644).write(content);
|
|
147
|
+
} else {
|
|
148
|
+
// Use sudo to write when not root
|
|
149
|
+
const tempPath = `/tmp/smartdaemon_${serviceArg.name}.service`;
|
|
150
|
+
await this.smartFs.file(tempPath).encoding('utf8').mode(0o644).write(content);
|
|
151
|
+
await this.execute(`mv ${tempPath} ${targetPath}`); // execute() will add sudo
|
|
152
|
+
await this.execute(`chmod 644 ${targetPath}`); // execute() will add sudo
|
|
153
|
+
}
|
|
108
154
|
}
|
|
109
155
|
}
|
|
110
156
|
|
|
111
157
|
public async deleteService(serviceArg: SmartDaemonService) {
|
|
112
158
|
if (await this.checkElegibility()) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
)
|
|
159
|
+
const filePath = SmartDaemonSystemdManager.createFilePathFromServiceName(serviceArg.name);
|
|
160
|
+
|
|
161
|
+
if (this.isRoot) {
|
|
162
|
+
await this.smartFs.file(filePath).delete();
|
|
163
|
+
} else {
|
|
164
|
+
await this.execute(`rm ${filePath}`); // execute() will add sudo
|
|
165
|
+
}
|
|
116
166
|
}
|
|
117
167
|
}
|
|
118
168
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as plugins from './smartdaemon.plugins.js';
|
|
2
1
|
import { SmartDaemon } from './smartdaemon.classes.smartdaemon.js';
|
|
3
2
|
import { SmartDaemonService } from './smartdaemon.classes.service.js';
|
|
4
3
|
|
|
@@ -15,7 +14,9 @@ export class SmartDaemonTemplateManager {
|
|
|
15
14
|
# version: ${serviceArg.version}
|
|
16
15
|
# description: ${serviceArg.description}
|
|
17
16
|
# command: ${serviceArg.command}
|
|
18
|
-
# workingDir: ${serviceArg.workingDir}
|
|
17
|
+
# workingDir: ${serviceArg.workingDir}${serviceArg.user ? `
|
|
18
|
+
# user: ${serviceArg.user}` : ''}${serviceArg.group ? `
|
|
19
|
+
# group: ${serviceArg.group}` : ''}
|
|
19
20
|
# ---
|
|
20
21
|
[Unit]
|
|
21
22
|
Description=${serviceArg.description}
|
|
@@ -23,7 +24,9 @@ Requires=network.target
|
|
|
23
24
|
After=network.target
|
|
24
25
|
|
|
25
26
|
[Service]
|
|
26
|
-
Type=simple
|
|
27
|
+
Type=simple${serviceArg.user ? `
|
|
28
|
+
User=${serviceArg.user}` : ''}${serviceArg.group ? `
|
|
29
|
+
Group=${serviceArg.group}` : ''}
|
|
27
30
|
Environment=NODE_OPTIONS="--max_old_space_size=100"
|
|
28
31
|
ExecStart=/bin/bash -c "cd ${serviceArg.workingDir} && ${serviceArg.command}"
|
|
29
32
|
WorkingDirectory=${serviceArg.workingDir}
|
|
@@ -5,8 +5,8 @@ export { path };
|
|
|
5
5
|
|
|
6
6
|
// @pushrocks scope
|
|
7
7
|
import * as lik from '@push.rocks/lik';
|
|
8
|
-
import * as smartfile from '@push.rocks/smartfile';
|
|
9
8
|
import * as smartfm from '@push.rocks/smartfm';
|
|
9
|
+
import * as smartfs from '@push.rocks/smartfs';
|
|
10
10
|
import * as smartlog from '@push.rocks/smartlog';
|
|
11
11
|
import * as smartlogDestinationLocal from '@push.rocks/smartlog-destination-local';
|
|
12
12
|
import * as smartpath from '@push.rocks/smartpath';
|
|
@@ -15,8 +15,8 @@ import * as smartsystem from '@push.rocks/smartsystem';
|
|
|
15
15
|
|
|
16
16
|
export {
|
|
17
17
|
lik,
|
|
18
|
-
smartfile,
|
|
19
18
|
smartfm,
|
|
19
|
+
smartfs,
|
|
20
20
|
smartlog,
|
|
21
21
|
smartlogDestinationLocal,
|
|
22
22
|
smartpath,
|