Reference
Command line
Every zerohead command and flag, with what each one prints or changes.
Installing puts the zerohead command in ~/.local/bin.
Commands
| Command | What it does |
|---|---|
zerohead serve | Runs the server until you press Ctrl-C. |
zerohead pair | Prints a one-time pairing code and link. |
zerohead status | Says whether a server is running and what the data folder holds. |
zerohead service install | Makes zerohead your own background service and starts it. |
zerohead service uninstall | Stops the service and removes it. Your data is kept. |
zerohead service status | Says whether the service is installed and running. |
zerohead connect --url <address> | Links this computer to a Connect service. |
zerohead connect status | Says whether the install is linked, and shows the relay and devices. |
zerohead connect refuse <id> | Turns a Connect device away on this computer. |
zerohead connect allow <id> | Lets a refused Connect device in again. |
zerohead disconnect | Unlinks this computer from Connect. |
Every command accepts --help. zerohead --version prints the version.
Flags that work everywhere
| Flag | Meaning | Default |
|---|---|---|
--home <folder> | The data folder. | See Settings |
--bind <address> | The address the server listens on. | 127.0.0.1 |
--port <port> | The port the server listens on. | 4747 |
serve
serve also takes --allowed-hosts, --tick-ms, --max-runs, --runs-per-hour, --run-timeout-s and --web-dir. Settings explains them. The installed program carries the web app inside it.
On start it prints the address and the data folder. If no device is paired, it also prints a pairing code. Ctrl-C cancels active runs and stops the server.
pair
pair writes a code straight into the install's database, so it works whether or not the server is running. The code works once and lasts 10 minutes.
status
status prints whether the server answers, the data folder, the number of companies and the number of paired devices. It creates nothing. If the folder has never been used, it says so.
service
service install works on Linux with systemd --user. It writes ~/.config/systemd/user/zerohead.service, which runs this program's serve with a data folder, bind address and port and the PATH of your terminal, enables it so it starts when you log in, and starts it or restarts it. Each of the three settings is the one you give on this command (--home, --bind, --port or their variables); otherwise the one the installed service already has; otherwise the default. It says which settings it kept when they are not the defaults, and what changed. It then waits until the service's own process answers and prints the address and, while no browser is paired, a pairing link. The service itself never writes a pairing code to its log. Run it again after the program changes: the install command does this when it updates.
A user service stops when you log out of your last session, which cancels running runs. service install says so when lingering is off; loginctl enable-linger keeps it running, if you choose.
It refuses when something other than this service already answers at the address. If it fails after writing the service file, running it again repairs it. Without a user service manager it changes nothing and tells you to run zerohead serve yourself. On macOS and Windows it says the service is not built for that system yet.
service uninstall stops the service, removes its file, leaves the data folder alone and names it. service status shows the service's state, file, data folder and address. --name (or ZEROHEAD_SERVICE_NAME) picks another service name; the default is zerohead.
connect
zerohead connect --url https://connect.example
zerohead connect --relink --url https://connect.example --name "My desktop"
--urlis required to link. It must behttps, orhttpfor a loopback address. There is no default.--relinklinks again when the install is already linked. The old link is removed.--namesets what the computer is called at the service. It defaults to the computer's name.
Without --relink, a linked install is left alone. connect status shows the relay state of a running server. refuse and allow take the device's Connect ID, which connect status lists. See Remote access.
disconnect
disconnect asks the service to unlink, then deletes the link file whether or not the service answered.