({
description,
envFile,
launchSpec,
supervisorArgs,
pathEnv,
homeDir,
userName,
logName,
}: {
description: string;
envFile: string;
launchSpec: SelfLaunchSpec;
supervisorArgs: string[];
pathEnv: string;
homeDir: string;
userName: string;
logName: string;
})
| 436 | } |
| 437 | |
| 438 | export function renderSystemdUnit({ |
| 439 | description, |
| 440 | envFile, |
| 441 | launchSpec, |
| 442 | supervisorArgs, |
| 443 | pathEnv, |
| 444 | homeDir, |
| 445 | userName, |
| 446 | logName, |
| 447 | }: { |
| 448 | description: string; |
| 449 | envFile: string; |
| 450 | launchSpec: SelfLaunchSpec; |
| 451 | supervisorArgs: string[]; |
| 452 | pathEnv: string; |
| 453 | homeDir: string; |
| 454 | userName: string; |
| 455 | logName: string; |
| 456 | }): string { |
| 457 | const execStart = quoteSystemdExecStart(launchSpec.command, supervisorArgs); |
| 458 | return [ |
| 459 | '[Unit]', |
| 460 | `Description=${description}`, |
| 461 | 'After=network-online.target', |
| 462 | 'Wants=network-online.target', |
| 463 | '', |
| 464 | '[Service]', |
| 465 | 'Type=simple', |
| 466 | `WorkingDirectory=${launchSpec.workingDirectory}`, |
| 467 | `Environment=HOME=${homeDir}`, |
| 468 | `Environment=USER=${userName}`, |
| 469 | `Environment=LOGNAME=${logName}`, |
| 470 | `Environment=PATH=${pathEnv}`, |
| 471 | `EnvironmentFile=${envFile}`, |
| 472 | `ExecStart=${execStart}`, |
| 473 | 'Restart=always', |
| 474 | 'RestartSec=2', |
| 475 | 'KillMode=process', |
| 476 | '', |
| 477 | '[Install]', |
| 478 | 'WantedBy=default.target', |
| 479 | '', |
| 480 | ].join('\n'); |
| 481 | } |
| 482 | |
| 483 | export function renderLaunchdPlist({ |
| 484 | label, |
no test coverage detected