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
| Flag | Type | Default | Description |
|---|---|---|---|
--script <path> | string | required | Path to a local script file |
--json | boolean | false | Output 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 --jsonHow it works
- Reads the script file from your local machine
- Uploads it to the VM via SSH (to
/tmp/) - Makes it executable (
chmod +x) - Executes it and streams stdout/stderr back
- 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 run | gibil exec | |
|---|---|---|
| Best for | One-liners, simple commands | Multi-step scripts |
| Quoting | You handle shell escaping | No escaping needed |
| Script location | Inline string argument | Local file |