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 monthly. Valid values are HOURLY, DAILY, WEEKLY For ex. --schedule DAILY Choices: HOURLY, DAILY, WEEKLY
--start_date
string
Start date/time in format ‘YYYY-MM-DD HH:MM:SS PM’ (UTC). Default is now. (optional)
--end_date
string
End date/time in format ‘YYYY-MM-DD HH:MM:SS PM’ (UTC). Default is 7 days from now. (optional)
--day
integer
default:"0"
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
integer
default:"0"
Hour of day you want scheduled job to run on (0-23) or ”*” (UTC). Default will be 0. For ex. --hour 16

Description

Available commands:
CommandDescription
lsList directory contents
rmRemove files or directories
duSummarize device usage for a set of files
Returns the output of the command executed on the instance. May take a few seconds to retrieve results.

Examples

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

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)