Skip to content

[Feature] Please provide bsk daemon install-autostart (and document the 10-minute idle exit) #337

Description

@zczsw123

Request

Please provide bsk daemon install-autostart / bsk daemon uninstall-autostart.

Why

The daemonize-mode error message recommends running the daemon "in a persistent host task". That is the right shape — but creating such a task is not possible from an agent / sandboxed environment, so every user has to invent their own launcher. We ended up writing a VBS launcher and reverse-engineering the constraints; that shouldn't be necessary.

What fails from an agent environment

Approach Result
Start-Process <bsk> daemon start daemon may appear, then is killed together with the spawning command (see #268 — fixed in 0.3.1, which we confirm improves this)
schtasks /create /tn ... /sc onlogon ERROR: Unspecified error
Register-ScheduledTask ... Unspecified error

What works today (user-side only, found by trial and error)

A silent launcher in the Startup folder. Two non-obvious requirements:

  1. it must use --foreground (the default daemonize mode fails on this host — see Windows: bsk daemon start auto-detached process exits immediately, extension cannot connect #218),
  2. the file must be pure ASCII — VBScript reads ANSI, and a UTF-8 file fails with a misleading unterminated string constant / object required error that points nowhere near the real cause.
' bsk daemon autostart (silent, at logon)
Set sh = CreateObject("WScript.Shell")
sh.Run """C:\Users\<user>\.local\bin\bsk.exe"" daemon start --foreground", 0, False

This works because explorer.exe spawns it, outside restricted job objects.

Also please document

  • Idle exit: daemon exceeded idle threshold; exiting idle_secs:600. Note the timer starts after the browser disconnects (with Edge connected we observed >44 min uptime). The practical rule a user needs is: "Edge open ⇒ the daemon should be up" — it is not a start-once-forever service, and after Edge has been closed for ~10 minutes the daemon is gone and must be relaunched.
  • If autostart is out of scope for now, publishing the recommended launcher snippet and the ASCII caveat in the README would save every user the same rediscovery.

中文摘要

请提供 bsk daemon install-autostart。报错里推荐的"persistent host task"在 agent/沙箱环境里建不了(schtasks、Register-ScheduledTask 均报 Unspecified error),只能由用户在启动文件夹放 VBS(必须 --foreground,且必须纯 ASCII,否则报"未结束的字符串常量"这种指不到真因的错误)。另外请把空闲 10 分钟自动退出写进文档——计时是从"浏览器断开"之后开始的,用户需要知道"Edge 开着,daemon 就该在",它不是一次性常驻服务。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions