Scheduled Cronjobs

Scheduled Cronjobs

Overview

Scheduled cronjobs are Commands with a schedule parameter added. When you add a cron schedule expression to a command, it automatically becomes a cronjob that runs at the specified times.

To create a scheduled cronjob, simply create a command with the schedule parameter:

tapit create command name=my-cronjob 'python scripts/my_task.py' schedule='0 * * * *'

See the Commands page for the full CLI reference including all available parameters.

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 *'

Examples

# Daily backup at 2 AM
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

# Weekly report generation on Mondays at 9 AM
tapit create command name=weekly-report 'python scripts/generate_report.py' schedule='0 9 * * 1' description='Generate weekly report'