Skip to content

Setup scripts and env

A setup script runs once, on the VM’s first boot, as the default user agentcloud, with each --env variable exported.

Terminal window
cat setup.sh | ssh turm.dev new --name=demo --setup-script /dev/stdin --env API_TOKEN=abc123

For a short script, pass it inline:

Terminal window
ssh turm.dev new --setup-script '"#!/bin/sh\ntouch ~/ready"'

Save a script once and every new runs it:

Terminal window
cat setup.sh | ssh turm.dev defaults write new.setup-script /dev/stdin
ssh turm.dev new --name=demo # runs setup.sh, plus any --env you pass
ssh turm.dev new --name=other --setup-script '"echo just this one"' # replaces the default
ssh turm.dev new --name=bare --no-setup-script # skips it

defaults read new.setup-script prints the saved script, and defaults delete new.setup-script removes it. The script is kept with your account rather than on one server, so it applies wherever the VM is placed. Changing it doesn’t affect VMs that already exist.

ls shows setup: pending, ok or failed (exit N). The output is in ~/.agentcloud/setup.log. SSH sessions land as root, so use the full path:

Terminal window
ssh vm+demo@turm.dev cat /home/agentcloud/.agentcloud/setup.log
  • The script’s $HOME is /home/agentcloud. Write there or to /tmp; it can’t write to /root.
  • Go, Postgres and temp directories: Building in a VM.
  • Scripts are capped at 64 KiB. For something bigger, have the script download it.
  • The --env variables are also saved to ~/.agentcloud/env (mode 600), which login shells source.