feat(systemd-manager): Support sudo password and root detection in SystemdManager; add user/group support in services and templates; add tests and expand README
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import * as plugins from './smartdaemon.plugins.js';
|
||||
import { SmartDaemon } from './smartdaemon.classes.smartdaemon.js';
|
||||
import { SmartDaemonService } from './smartdaemon.classes.service.js';
|
||||
|
||||
@@ -15,7 +14,9 @@ export class SmartDaemonTemplateManager {
|
||||
# version: ${serviceArg.version}
|
||||
# description: ${serviceArg.description}
|
||||
# command: ${serviceArg.command}
|
||||
# workingDir: ${serviceArg.workingDir}
|
||||
# workingDir: ${serviceArg.workingDir}${serviceArg.user ? `
|
||||
# user: ${serviceArg.user}` : ''}${serviceArg.group ? `
|
||||
# group: ${serviceArg.group}` : ''}
|
||||
# ---
|
||||
[Unit]
|
||||
Description=${serviceArg.description}
|
||||
@@ -23,7 +24,9 @@ Requires=network.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Type=simple${serviceArg.user ? `
|
||||
User=${serviceArg.user}` : ''}${serviceArg.group ? `
|
||||
Group=${serviceArg.group}` : ''}
|
||||
Environment=NODE_OPTIONS="--max_old_space_size=100"
|
||||
ExecStart=/bin/bash -c "cd ${serviceArg.workingDir} && ${serviceArg.command}"
|
||||
WorkingDirectory=${serviceArg.workingDir}
|
||||
|
Reference in New Issue
Block a user