GibilGibil

gibil exec

Upload and run a local script on a remote server

Sometimes you need to run a multi-step operation that's painful to express as a single gibil run string. Write a script locally, upload it, execute it.

Usage

gibil exec <name> --script <path> [--json]

Options

FlagTypeDefaultDescription
--script <path>stringrequiredPath to a local script file
--jsonbooleanfalseOutput as JSON

Examples

# Upload and run a deployment script
gibil exec my-app --script ./deploy.sh

# A test harness with JSON output
gibil exec my-app --script ./run-tests.sh --json

How it works

  1. Reads the script file from your local machine
  2. Uploads it to the VM via SSH (to /tmp/)
  3. Makes it executable (chmod +x)
  4. Executes it and streams stdout/stderr back
  5. Returns the exit code

The script runs in /bin/bash. Add a shebang (#!/bin/bash) at the top for clarity. The working directory is /root.

When to use exec vs run

gibil rungibil exec
Best forOne-liners, simple commandsMulti-step scripts
QuotingYou handle shell escapingNo escaping needed
Script locationInline string argumentLocal file

Next steps

On this page