Skip to content

up, down, restart, status, logs

The daily commands. Each has a shell helper (benchup, benchdown, benchrestart, benchstatus, benchlogs, benchfg, benchwatch, benchcd), see Benches and sites. Every command takes the options for every command, most often --bench-dir DIR for a bench that is not the default.

up

benchbar up [--services-only] [--json] [--bench-dir DIR]

Starts the bench in the background and waits for the site’s ping. It clears the stop flag and loads the launchd agent when it is not loaded. Before that it checks the bench’s ports: it refuses to start when a running bench, or any other program, listens on one of them (it never takes their ports), and asks when only a stopped bench shares them. Both print benchbar ports setup -- PATH as the fix. A running bench is left as it is.

With --json (or --jsonl, --for-agent) it prints JSON lines: the steps, then a done with exit, changed, warnings, next_actions and state_after (the done fields).

--services-only starts the bench’s Redis (queue and cache) and nothing else: no agent, no web process, no stop flag, and no service needs to be installed. It is for a site restore, a pull or a bench migrate on a bench that is not running, which need that Redis. It stays up until benchbar down. A Redis port held by another program is refused. benchbar status --json shows both in redis.

Exit codes: 0 the bench is up (or already was); 1 the site did not answer in time (it may still be starting: benchbar logs), a port is taken, or you declined the port question.

benchbar up --bench-dir ~/dev/v16-bench

down

benchbar down [--json] [--bench-dir DIR] [--dry-run]

Stops the bench and keeps it stopped, also across reboots: it writes manual to the stop flag and stops the agent. Then it stops what is left: this bench’s honcho, serve, worker, schedule and socketio processes, and the processes listening on the bench’s web, socketio or Redis ports that run inside the bench folder. A listener started elsewhere, such as another bench or an unrelated server, is left alone; benchbar ports check --bench-dir DIR shows whether one holds the ports. Your own bench migrate or bench console keeps running.

With --json it prints the same JSON lines as up.

Exit codes: 0 stopped; 1 some bench processes are still alive.

benchbar down

restart

benchbar restart [--json] [--bench-dir DIR]

Restarts every process and waits for the site. Needed after Python changes: the web server reloads by itself, the worker does not. With --json it prints the same JSON lines as up.

Exit codes: 0 the site answers; 1 it did not answer in time, a port is taken, or you declined the port question.

benchbar restart

status

benchbar status [--json] [--ping] [--bench-dir DIR]

Agent state, pid, stop reason, last exit code, the processes, the site ping, the ports and the log path. In --json, bench_bin is the bench its service runs, pending_operations lists an app update or app add that stopped half way, and state is not_adopted for a bench folder that benchbar does not manage yet (benchbar adopt PATH changes that). --json prints the versioned JSON in the schema.

The app runs status for every bench, so it is cheap: one launchctl call, and one ping of the default site while the bench runs. The other sites are not asked; --ping asks each of them once and fills ping_code in the JSON’s sites, but only while the bench runs. A stopped bench is never pinged.

Exit codes: 0 always, whatever the state; 1 only when no bench is found.

benchbar status --json

logs

benchbar logs [--worker | --worker-error | --previous] [-n50] [--no-follow] [--process NAME] [--since TIME] [--since-restart] [--json]

Tails logs/bench.log and follows it in a terminal.

FlagWhat it does
--workerlogs/worker.log instead
--worker-errorlogs/worker.error.log instead
--previouslogs/bench.previous.log, the tail of the run before
-n50The last 50 lines (the default); any number works, -n then the count
--no-followPrint and exit
--process NAMEOnly the lines of one honcho process: web, socketio, schedule, redis_queue, redis_cache. worker reads logs/worker.log instead, where Procfile.lean sends the worker (it never writes to bench.log); --previous does not combine with it, since worker.log has no previous file
--since TIMEWith --json: only the lines at or after TIME (ISO 8601, YYYY-MM-DD HH:MM:SS, a date, or HH:MM:SS today; a time with no zone is local time)
--since-restartWith --json: only the lines after the bench’s last start
--jsonThe lines as JSON, with mtime and one time per line in ts (schema)

Exit codes: 0; 1 for a bad -n or --process value, or for --process worker with --previous.

benchbar logs --json --no-follow -n100 --process worker

fg

benchbar fg [--bench-dir DIR]

Stops the service and runs honcho, the process manager, with Procfile.lean in the foreground, so the output of every process shows in the terminal. Ctrl+C stops it; benchup brings the background service back.

Exit codes: honcho’s; 1 when honcho or Procfile.lean is missing, a port is taken, or the background bench could not be stopped.

benchbar fg

watch

benchbar watch [--bench-dir DIR]

Runs bench watch for JS and CSS rebuilds. The lean Procfile has no watcher, so run this while you edit assets.

benchbar watch

path

benchbar path [--bench-dir DIR]

Prints the bench directory. benchcd is cd "$(benchbar path)".

cd "$(benchbar path)"