Skip to content

Run ​

CommandDoes
ahpdRun in this terminal. Ctrl+C stops it
ahpd startRun in the background
ahpd statusSay if it runs, and where
ahpd stopStop it, and wait up to 30 s
ahpd restartStop and start again with the same flags
ahpd restart --forceRestart even while a turn runs

start takes the same flags as ahpd. A bad flag is refused before anything starts.

Files ​

All in ~/.config/ahpd/ (or $XDG_CONFIG_HOME/ahpd/):

FileHolds
config.jsonThe configuration
daemon.logWhat a background daemon prints. Moved aside at 5 MiB
daemon.jsonThe running daemon's pid, URL and flags. Mode 0600
sessions/Each session's settings and owner
automations/One Markdown file per automation
vault.jsonSecrets. See Vault
bash
tail -f ~/.config/ahpd/daemon.log

Restart ​

ahpd restart keeps the sessions, and the port when it is fixed. It is refused while a turn runs, and the refusal names the sessions:

bash
ahpd restart            # waits for no turn
ahpd restart --force    # ends the running turns

Before it stops, the daemon checks that the new code accepts the recorded flags. If it does not, the restart is refused and the old daemon keeps running.

Environment and folder

The new daemon keeps the old one's environment variables and working folder. To change either, use ahpd stop and ahpd start.

From another machine: ahpd --remote <url> restart. See Remote access.

Served folders ​

The daemon serves the folders in paths. With none, it serves the folder it started in.

bash
ahpd paths list
ahpd paths add /work/web
ahpd paths remove /work/web

A running daemon with the HTTP API on takes the change at once. Otherwise, run ahpd restart.

Started at a terminal in a folder it does not serve, ahpd asks:

Serve /work/new? [y/N]:

Yes adds it to paths. To never ask, pass --no-cwd. It serves only paths and --path.

TIP

A path is where sessions are listed and created by default. It is not a fence: a client may still open a session in any folder on the machine. The connection token decides who may connect.

Output for scripts ​

Every command takes these:

FlagDoes
--jsonPrint the answer as JSON on stdout
--quietPrint only the id the answer names
--verboseAdd diagnostics on stderr
--no-colorNo colour. Also off for a non-terminal or with NO_COLOR
--yesRemove without asking. A script with no terminal needs it
bash
ahpd status --json | jq .url
ahpd plugin list --json | jq '.[].state'

Shell completion ​

bash
ahpd completion bash > /etc/bash_completion.d/ahpd
bash
ahpd completion zsh > "${fpath[1]}/_ahpd"
bash
ahpd completion fish > ~/.config/fish/completions/ahpd.fish