Skip to main content
Execute a (constrained) remote command on a machine

Usage

vastai execute id COMMAND

Arguments

id
integer
required
id of instance to execute on
COMMAND
string
required
bash command surrounded by single quotes

Options

--schedule
string
try to schedule a command to run hourly, daily, or weekly. Valid values are HOURLY, DAILY, WEEKLY For ex. —schedule DAILY Allowed values: HOURLY, DAILY, WEEKLY
--start_date
string
default:"2026-06-23"
Start date/time in format ‘YYYY-MM-DD HH:MM:SS PM’ (UTC). Default is now. (optional)
--end_date
string
default:"2026-06-30"
End date/time in format ‘YYYY-MM-DD HH:MM:SS PM’ (UTC). Default is 7 days from now. (optional)
--day
parse_day_cron_style
Day of week you want scheduled job to run on (0-6, where 0=Sunday) or ”*”. Default will be 0. For ex. —day 0
--hour
parse_hour_cron_style
Hour of day you want scheduled job to run on (0-23) or ”*” (UTC). Default will be 0. For ex. —hour 16

Examples

vastai execute 99999 'ls -l -o -r'
  vastai execute 99999 'rm -r home/delete_this.txt'
  vastai execute 99999 'du -d2 -h'

available commands:
  ls                 List directory contents
  rm                 Remote files or directories
  du                 Summarize device usage for a set of files

Return value:
Returns the output of the command which was executed on the instance, if successful. May take a few seconds to retrieve the results.

Global Options

The following options are available for all commands:
OptionDescription
--url URLServer REST API URL
--retry NRetry limit
--rawOutput machine-readable JSON
--explainVerbose explanation of API calls
--api-key KEYAPI key (defaults to ~/.config/vastai/vast_api_key)