Commands

Overview

Commands in Tapitalee are scheduled tasks that run automatically based on cron expressions or manual triggers. Unlike one-time tasks, commands are persistent job definitions that can be executed repeatedly, making them ideal for maintenance operations, data processing pipelines, monitoring tasks, and recurring business processes.

Purpose and Benefits

  • Scheduled Execution: Automatic execution based on cron schedules
  • Manual Triggers: On-demand execution for testing and maintenance via Tapitalee web interface
  • Resource Control: Configurable CPU, memory, and execution limits
  • Audit Trail: Complete history of all command executions
  • Environment Integration: Full access to app environment and resources

CLI Usage

Create Command

tapit  create command name=command-name 'command to run' [schedule='cron-expression'] [memory|cpu|image|image_tag|max_hours]=value [description='text']

Required Parameters

  • name: Command name (alphanumeric with hyphens)
  • command: Shell command to execute (quoted string)

Optional Parameters

  • schedule: Cron expression for automatic scheduling
  • memory: Memory allocation in GB (default: 2.0, sandbox limit: 1.0)
  • cpu: CPU allocation in vCPUs (default: 1.0, sandbox limit: 0.25)
  • image: Custom container image
  • image_tag or tag: Specific image tag to use
  • max_hours: Maximum execution time in hours
  • description: Human-readable description of the command

Examples

# Daily backup command
tapit create command name=daily-backup 'python scripts/backup_database.py' schedule='0 2 * * *' description='Daily database backup'

# Hourly data sync
tapit create command name=data-sync 'python sync/hourly_sync.py' schedule='0 * * * *' memory=2.0

Modify Command

tapit  set command name=command-name ['new command'] [schedule='cron-expression'] [memory|cpu|image|tag|max_hours]=value [description='text']

Modifiable Parameters

  • command: Update the shell command to execute
  • schedule: Change or remove the cron schedule
  • memory: Update memory allocation
  • cpu: Update CPU allocation
  • image: Change container image
  • tag: Update image tag
  • max_hours: Modify execution time limit
  • description: Update description

List Commands

tapit  list commands

Shows all commands with their configuration and execution status.

Manual Command Execution

Commands can be executed manually regardless of their schedule using the task creation functionality:

# Execute a command manually by creating a task
tapit create task 'python scripts/backup_database.py'

Delete Command

tapit  delete command name=command-name

Permanently removes a command definition and cancels any scheduled executions.

Cron Schedule Expressions

Standard Cron Format

┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday)
│ │ │ │ │
* * * * *

Common Schedule Patterns

Time-Based Scheduling

# Every minute
schedule='* * * * *'

# Every 15 minutes
schedule='*/15 * * * *'

# Every hour at minute 0
schedule='0 * * * *'

# Every day at 2:30 AM
schedule='30 2 * * *'

# Every Sunday at 3:00 AM
schedule='0 3 * * 0'

# First day of every month at midnight
schedule='0 0 1 * *'

Business Hours Scheduling

# Every hour during business hours (9 AM - 5 PM, weekdays)
schedule='0 9-17 * * 1-5'

# Every 30 minutes during business hours
schedule='*/30 9-17 * * 1-5'

# End of business day (weekdays at 6 PM)
schedule='0 18 * * 1-5'

Maintenance Windows

# Weekly maintenance (Sunday 3 AM)
schedule='0 3 * * 0'

# Monthly maintenance (first Sunday 4 AM)
schedule='0 4 1-7 * 0'

# Quarterly cleanup (first day of quarter 2 AM)
schedule='0 2 1 1,4,7,10 *'