`surge service`
Manage Surge as a system service. A service runs the headless server in the background and is suitable for a home server, workstation, or other machine that should keep its queue after you close the terminal.
Install the service
Section titled “Install the service”Run this from an elevated terminal where required:
surge service installSurge creates a dedicated token for the system service. This token is separate from the token used by an interactive, per-user Surge server.
Start and check the service
Section titled “Start and check the service”surge service startsurge service statusOnce it is running, normal control commands target the server:
surge add https://example.com/archive.zipsurge lsRetrieve the service token
Section titled “Retrieve the service token”Use the service token when connecting a remote TUI or the browser extension:
surge service tokenThe token may be protected by the operating system. On Linux, retry with
sudo when the command cannot read it.
Stop or uninstall
Section titled “Stop or uninstall”surge service stopsurge service uninstallUninstalling removes the system service. It does not intentionally remove downloaded files; inspect your Surge data locations before removing configuration or state manually.
When to use a service
Section titled “When to use a service”Use surge service when the engine should run independently of a terminal.
For a short, foreground batch download, prefer:
surge server --batch urls.txt --exit-when-doneFor the full remote-control flow, see Connect to a remote server.