zerohead
Get started

Reference

Command line

Every zerohead command and flag, with what each one prints or changes.

The source is not public yet. It will be published under MIT. The pages under Contributing describe working on it once it is.

Installing puts the zerohead command in ~/.local/bin.

Commands

CommandWhat it does
zerohead serveRuns the server until you press Ctrl-C.
zerohead pairPrints a one-time pairing code and link.
zerohead statusSays whether a server is running and what the data folder holds.
zerohead service installMakes zerohead your own background service and starts it.
zerohead service uninstallStops the service and removes it. Your data is kept.
zerohead service statusSays whether the service is installed and running.
zerohead connect --url <address>Links this computer to a Connect service.
zerohead connect statusSays 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 disconnectUnlinks this computer from Connect.

Every command accepts --help. zerohead --version prints the version.

Flags that work everywhere

FlagMeaningDefault
--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"
  • --url is required to link. It must be https, or http for a loopback address. There is no default.
  • --relink links again when the install is already linked. The old link is removed.
  • --name sets 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.

zeroheadHomeMIT license