Scripts
The SCRIPTS tab lets you save, manage, and run shell scripts on your server — with support for secret variables, variable substitution, and PTY mode for interactive commands.
Creating a Script
- Click + NEW SCRIPT in the SCRIPTS tab
- Fill in:
| Field | Description |
|---|---|
| Name | Display name |
| Description | Optional — shown in the script list |
| Working directory | Default ~ — directory where the script runs |
| Content | Shell script body |
- Click SAVE
Variables
Scripts support {{VARIABLE}} substitution. Define variables in the Variables section of the script editor:
| Type | Behaviour |
|---|---|
| Plain | Value shown in UI, passed as-is |
| Secret | Value stored encrypted in vault; always masked in UI — shown as •••••• |
Example
#!/bin/bash
echo "Deploying to {{ENV}}"
aws s3 sync ./dist s3://{{BUCKET}}/{{ENV}}/ --delete
Variables panel: ENV = production, BUCKET = myapp-assets (or use a secret for credentials).
When you click RUN, KoreShell substitutes all {{VAR}} placeholders before sending the script to the server.
Running a Script
Click ▶ RUN on any script card:
- Output streams live to the log panel
- Exit code is shown when the script finishes
- Full output is saved in run history
PTY Mode
Enable Run in PTY for scripts that require a pseudo-terminal — interactive prompts, sudo, vim, progress bars with ANSI escape codes.
In PTY mode the script runs in a full terminal session. The output panel becomes an interactive terminal — you can type responses to prompts.
:::note PTY mode and secrets In PTY mode, secret variable values are substituted before the script runs — they never appear in the terminal echo. :::
Script History
Each script keeps a log of all runs: timestamp, exit code, and full output. Click a script → HISTORY.
Deleting a Script
Right-click a script → Delete. Scripts are soft-deleted — they disappear from the list but their run history is preserved in the database.
Tips
Use scripts for recurring tasks: database dumps, log rotation, health checks, cleanup jobs.
Chain scripts: call one script from another by referencing its path on the server.
Schedule via backup cron: if you need a script to run on a schedule, add it as a custom rclone "job" with the script as the deploy command, or set up a cron entry directly via the terminal.