fix: add KillMode=process so remote-control survives restarts
systemd's default KillMode=control-group kills all processes in the cgroup on service restart, including the detached claude remote-control process. KillMode=process only kills the main Node.js process, letting detached children survive. restoreRemoteControl() already handles reattaching on startup. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -62,6 +62,7 @@ ExecStart=${nodePath} ${projectRoot}/dist/index.js
|
||||
WorkingDirectory=${projectRoot}
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
KillMode=process
|
||||
Environment=HOME=${homeDir}
|
||||
Environment=PATH=/usr/local/bin:/usr/bin:/bin:${homeDir}/.local/bin
|
||||
StandardOutput=append:${projectRoot}/logs/nanoclaw.log
|
||||
@@ -142,6 +143,16 @@ describe('systemd unit generation', () => {
|
||||
expect(unit).toContain('RestartSec=5');
|
||||
});
|
||||
|
||||
it('uses KillMode=process to preserve detached children', () => {
|
||||
const unit = generateSystemdUnit(
|
||||
'/usr/bin/node',
|
||||
'/home/user/nanoclaw',
|
||||
'/home/user',
|
||||
false,
|
||||
);
|
||||
expect(unit).toContain('KillMode=process');
|
||||
});
|
||||
|
||||
it('sets correct ExecStart', () => {
|
||||
const unit = generateSystemdUnit(
|
||||
'/usr/bin/node',
|
||||
|
||||
Reference in New Issue
Block a user