A collection of scripts designed to be run remotely via curl with support for multiple arguments and options.
- ✅ Run scripts remotely with a single curl command
- ✅ Support for multiple command-line arguments and options
- ✅ Proper error handling and logging
- ✅ Cross-platform compatibility (macOS and Linux)
- ✅ Timeout support for long-running operations
- ✅ Multiple output formats (text, JSON)
- ✅ Comprehensive system health checking
- ✅ User-friendly CLI with interactive menu
- ✅ Universal
rsrentry point (POSIX-compatible)
The rsr command is a universal, POSIX-compatible entry point that works everywhere:
# Remote execution via curl
curl -fsSL https://codefuturist.github.io/remote-script-runner/rsr | sh -s -- health -a
# Or with bash -c form
/bin/sh -c "$(curl -fsSL https://codefuturist.github.io/remote-script-runner/rsr)" -- health -aAvailable commands:
rsr health -a # Run all health checks
rsr health -s cpu -s memory # Specific checks
rsr setup -d -u admin nginx # Server setup (dry-run)
rsr list # List available scripts
rsr --help # Show help🎯 Direct Script Syntax (see SYNTAX_GUIDE.md for full comparison)
# Pattern 1: Pipe Form (RECOMMENDED for most cases)
curl -fsSL https://example.com/script.sh | bash -s -- [ARGUMENTS]
# Pattern 2: bash -c Form (for restricted environments)
/bin/bash -c "$(curl -fsSL https://example.com/script.sh)" -- [ARGUMENTS]Always use the -- separator to clearly separate bash options from script arguments.
# Run all health checks (using pipe form)
curl -fsSL https://codefuturist.github.io/remote-script-runner/system-health-check.sh | bash -s -- -a
# Run specific checks with verbose output
curl -fsSL https://codefuturist.github.io/remote-script-runner/system-health-check.sh | bash -s -- -v -s cpu -s memory -s disk
# Setup a server with nginx and docker (bash -c form for sudo environments)
/bin/bash -c "$(curl -fsSL https://codefuturist.github.io/remote-script-runner/server-setup.sh)" -- -u admin -p production -i nginx -i docker
# Dry run server setup with verbose output
curl -fsSL https://codefuturist.github.io/remote-script-runner/server-setup.sh | bash -s -- -d -v -u dev -p development nodejs git vimEach script is available in multiple shell-specific versions:
- Root directory: Original bash scripts with
#!/bin/bashshebang scripts/bash/: Bash-specific versionsscripts/zsh/: Zsh-enhanced versions with advanced featuresscripts/sh/: POSIX-compliant versions for maximum portabilityscripts/fish/: Fish shell versions with user-friendly syntax
See scripts/README.md for details on shell-specific features.
run-script.sh - Interactive CLI with menu:
# Show interactive menu (default when no args)
./run-script.sh
# Direct command execution
./run-script.sh health-check -a
./run-script.sh server-setup -d -u admin -p production nginxrun - Simple CLI for quick access:
# Quick health check
./run health -a
./run health -s cpu -s memory
# Server setup
./run setup -d -u admin -p production nginx🚀 One-liner Installation:
# Install remote-runner to ~/.local/bin/remote-runner
curl -fsSL https://codefuturist.github.io/remote-script-runner/install.sh | bash
# Then use it anywhere:
remote-runner health -a
remote-runner setup -d -u admin -p production nginx⚡ Direct Execution (no installation):
# Run health check directly
curl -fsSL https://codefuturist.github.io/remote-script-runner/remote-runner.sh | bash -s -- health -a
# Run server setup directly
curl -fsSL https://codefuturist.github.io/remote-script-runner/remote-runner.sh | bash -s -- setup -d -u admin -p production nginx
# Show help
curl -fsSL https://codefuturist.github.io/remote-script-runner/remote-runner.sh | bash -s -- -h📥 Download and Reuse:
# Download once
curl -fsSL https://codefuturist.github.io/remote-script-runner/remote-runner.sh -o remote-runner.sh
chmod +x remote-runner.sh
# Use multiple times
./remote-runner.sh health -s cpu memory
./remote-runner.sh setup -hA comprehensive system health monitoring script that can check:
- CPU: Usage percentage and load averages
- Memory: RAM usage statistics
- Disk: Storage usage for all mounted filesystems
- Network: Network interface status and IP addresses
- Services: Status of common system services
- Uptime: System uptime and boot information
./system-health-check.sh [OPTIONS] [CHECKS...]| Option | Description |
|---|---|
-h, --help |
Display help message |
-v, --verbose |
Enable verbose output |
-t, --timeout SECONDS |
Set timeout for each check (default: 10) |
-l, --log FILE |
Log output to file |
-f, --format FORMAT |
Output format: text, json (default: text) |
-s, --select CHECKS |
Select specific checks (can be used multiple times) |
-a, --all |
Run all available checks |
cpu- CPU usage and load averagememory- Memory usage statisticsdisk- Disk usage for all mounted filesystemsnetwork- Network interface statisticsservices- Check status of common servicesuptime- System uptime information
# Local execution
./system-health-check.sh -v -s cpu -s memory -s disk
./system-health-check.sh -a -t 5
./system-health-check.sh -l /var/log/health-check.log -f json -a
# Remote execution
/bin/bash -c "$(curl -fsSL https://codefuturist.github.io/remote-script-runner/system-health-check.sh)" -- -v -s cpu memory disk -t 5 >> /var/log/health-check.log 2>/dev/nullA server configuration script that simulates setting up a server environment with user configuration, profile application, and package installation.
./server-setup.sh [OPTIONS] [PACKAGES...]| Option | Description |
|---|---|
-h, --help |
Display help message |
-u, --username USERNAME |
Set username for configuration (required) |
-p, --profile PROFILE |
Environment profile: development|production (default: development) |
-i, --install PACKAGES |
Packages to install (can be used multiple times) |
-d, --dry-run |
Show what would be done without executing |
-v, --verbose |
Enable verbose output |
nginx- Web serverdocker- Container platformnodejs- JavaScript runtimepython3- Python programming languagegit- Version control systemcurl- Command line HTTP clientvim- Text editorhtop- Process monitorfail2ban- Intrusion prevention
# Local execution
./server-setup.sh -u admin -p production -i nginx -i docker
./server-setup.sh -u dev -p development nodejs git vim htop
./server-setup.sh -d -u admin -p production -i nginx -i docker # Dry run
# Remote execution
/bin/bash -c "$(curl -fsSL https://codefuturist.github.io/remote-script-runner/server-setup.sh)" -- -u admin -p production -i nginx docker
/bin/bash -c "$(curl -fsSL https://codefuturist.github.io/remote-script-runner/server-setup.sh)" -- -d -v -u dev nodejs python3 gitThe pattern for running scripts remotely with arguments is:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/username/repo/main/script.sh)" -- [SCRIPT_ARGUMENTS]Key components:
-
curl -fsSL: Downloads the script content-f: Fail silently on HTTP errors-s: Silent mode (no progress bar)-S: Show errors even in silent mode-L: Follow redirects
-
/bin/bash -c "$(...)": Executes the downloaded script -
-- [ARGUMENTS]: The--separates bash options from script arguments
# System monitoring in cron
*/5 * * * * /bin/bash -c "$(curl -fsSL https://codefuturist.github.io/remote-script-runner/system-health-check.sh)" -- -s cpu memory disk >> /var/log/health.log 2>&1
# Server provisioning
/bin/bash -c "$(curl -fsSL https://codefuturist.github.io/remote-script-runner/server-setup.sh)" -- -u $(whoami) -p production nginx docker python3
# Quick health check with timeout
/bin/bash -c "$(curl -fsSL https://codefuturist.github.io/remote-script-runner/system-health-check.sh)" -- -a -t 30
# Dry run before actual execution
/bin/bash -c "$(curl -fsSL https://codefuturist.github.io/remote-script-runner/server-setup.sh)" -- -d -v -u admin -p production nginx# Execute on remote server
ssh user@server '/bin/bash -c "$(curl -fsSL https://codefuturist.github.io/remote-script-runner/system-health-check.sh)" -- -a'
# Multiple servers
for server in web1 web2 db1; do
echo "Checking $server..."
ssh "user@$server" '/bin/bash -c "$(curl -fsSL https://codefuturist.github.io/remote-script-runner/system-health-check.sh)" -- -s cpu memory'
done# Use zsh explicitly (pipe form)
curl -fsSL https://codefuturist.github.io/remote-script-runner/system-health-check.sh | zsh -s -- -v -s cpu memory
# Use zsh with bash -c form
zsh -c "$(curl -fsSL https://codefuturist.github.io/remote-script-runner/system-health-check.sh)" -- -s uptime
# Auto-detect current shell
curl -fsSL https://codefuturist.github.io/remote-script-runner/system-health-check.sh | "$SHELL" -s -- -a
# Cross-platform: use bash for consistency
curl -fsSL https://codefuturist.github.io/remote-script-runner/server-setup.sh | bash -s -- -d -u admin -p development nodejs# Basic execution with PowerShell
Invoke-RestMethod -Uri 'https://codefuturist.github.io/remote-script-runner/system-health-check.sh' | bash -s -- -v -s cpu memory
# Save and execute
$script = Invoke-RestMethod -Uri 'https://codefuturist.github.io/remote-script-runner/server-setup.sh'
$script | bash -s -- -d -u admin -p production nginx docker
# One-liner from any shell
pwsh -Command "Invoke-RestMethod -Uri 'https://codefuturist.github.io/remote-script-runner/system-health-check.sh' | bash -s -- -a"
# Windows with WSL
Invoke-RestMethod -Uri 'https://codefuturist.github.io/remote-script-runner/system-health-check.sh' | wsl bash -s -- -s uptime# Pin to specific version (using GitHub raw URL for commit pinning)
COMMIT="d943416"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/codefuturist/remote-script-runner/${COMMIT}/system-health-check.sh)" -- -a
# Download, review, then execute
curl -fsSL https://codefuturist.github.io/remote-script-runner/system-health-check.sh > /tmp/check.sh
less /tmp/check.sh # Review first
chmod +x /tmp/check.sh && /tmp/check.sh -- -a📖 See SYNTAX_GUIDE.md for comprehensive syntax recommendations and advanced patterns.
- Always review scripts before running them remotely
- Use HTTPS URLs to prevent man-in-the-middle attacks
- Consider pinning to specific commits/tags instead of
mainbranch - Validate the source and integrity of scripts
- Be cautious with scripts that require elevated privileges
For production use, consider:
# Download and review first
curl -fsSL https://raw.githubusercontent.com/username/repo/main/script.sh > script.sh
less script.sh # Review the script
chmod +x script.sh
./script.sh -a # Run locally after review
# Or pin to a specific commit
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/username/repo/abc123def/script.sh)" -- -aFollow these patterns to create scripts that work well remotely:
#!/bin/bash
set -euo pipefail
# Use getopt for robust argument parsing
TEMP=$(getopt -o hvs: --long help,verbose,select: -n "$0" -- "$@")
eval set -- "$TEMP"# Exit on errors
set -euo pipefail
# Handle missing dependencies
if ! command -v required_tool >/dev/null 2>&1; then
echo "Error: required_tool is not installed"
exit 1
fi# Support different output formats
log() {
local level="$1"
local message="$2"
if [[ "$OUTPUT_FORMAT" == "json" ]]; then
echo "{\"level\":\"$level\",\"message\":\"$message\"}"
else
echo "[$level] $message"
fi
}# Use timeout for potentially long-running operations
timeout "$TIMEOUT" some_long_operation || echo "Operation timed out"- Fork the repository
- Create a feature branch
- Add your script following the established patterns
- Update the README with usage examples
- Submit a pull request
MIT License - feel free to use these scripts in your own projects.