LogoLogo
Run to Console
  • ClawCloud Run
    • Document
    • Getting Started
      • Create a DevBox
      • Deploy Database
      • Deploy from Docker
      • Deploy from Template
    • Guide
      • App Launchpad
        • Install Application
        • Update Application
        • Custom Domain
        • Exposing Multiple Ports
        • Environment Variables
        • Configuration Files
        • Auto Scaling
        • Persistent Storage
        • Custom Domain Certificates
      • Devbox
        • Devbox List
        • Devbox Details
        • Devbox Release
      • Database
        • PostgreSQL
        • MySQL
        • Redis
        • MongoDB
        • Kafka
        • Milvus
      • Object Storage
      • Advanced
        • Workspace
        • Terminal
        • Cron Job
        • KubeConfig
    • Pricing
    • Billing & Usage
    • Migration
      • Migrate from Docker
      • Migrate from Docker Compose
    • Architecture
      • Devbox Architecture
      • System Architecture
      • User Architecture
    • Legal
      • Privacy Policy
      • Terms and Conditions
      • Data Processing Addendum
    • Changelog
    • Best Practice
    • FAQ
    • More
      • Abuse Complaint
    • Help
  • Blog
Powered by GitBook

Copyright @ 2023-Present CLAWCLOUD. All Rights Reserved.

On this page
  • Typical Use Cases
  • Scheduled Scaling Configuration
  • Scheduled Power On/Off

Was this helpful?

Export as PDF
  1. ClawCloud Run
  2. Guide
  3. Advanced

Cron Job

Learn how to easily create and manage scheduled tasks on ClawCloud Run.

PreviousTerminalNextKubeConfig

Last updated 2 months ago

Was this helpful?

In ClawCloud Run, a Cron Job is used to create tasks that run at regular intervals. Unlike regular applications, Cron Jobs automatically trigger tasks based on a predefined schedule, making them ideal for maintenance routines or data processing scenarios.

Typical Use Cases

  1. Data Backup and Synchronization: Execute daily backups at midnight.

  2. Scheduled Notifications: Send daily summary emails at a fixed time.

  3. Batch Processing: Run data processing tasks every hour.

  4. Scheduled Scaling: Perform scaling operations at set times.

Below is an example of how to configure a scheduled scaling task in ClawCloud Run.

Scheduled Scaling Configuration

For applications that experience predictable traffic fluctuations (such as during e-commerce promotions, gaming events, or office systems), scheduled scaling allows for precise resource management.

Example Use Cases

  • E-commerce Promotions: Scale up to 10 instances from 09:00 to 23:00 during peak promotional hours and scale down to 3 instances during off-peak hours.

  • Office Systems: Maintain 5 instances on weekdays from 08:00 to 20:00 and reduce to 1 instance during non-business hours.

  • Gaming Events: Scale up to 15 instances on weekends, while keeping 5 instances on weekdays.

Configuration Steps

Creating a Scheduled Task

  1. Open the Cron Job section in the ClawCloud Run console.

  2. Click the Add Cron Job button to create a new task.

Configuring Basic Parameters

  • Task Name: Provide an easily recognizable name, such as "nginx-scale".

  • Task Type: Choose the task type:

    • Scale APP Launchpad: Scale application instances.

    • Access URL: Access a specified URL.

    • Execute Command: Run a custom command.

  • Cron Expression: Set the execution time using a Cron expression (based on Singapore Time).

  • App Name: When selecting Scale APP Launchpad, specify the target application for scaling.

  • Replica Count: When using Scale APP Launchpad, specify the desired number of instances.

Example Configuration:

Task Name: nginx-scale
Schedule: 0 8 * * *  # Executes daily at 8:00 AM Singapore Time
Replica Count: 5

This configuration means:

  • Cron Expression: 0 8 * * * — The task runs daily at 8:00 AM Singapore Time.

  • Replica Count: The application instance count will be adjusted to 5.

Scheduled Power On/Off

For applications that need to be periodically paused (such as development environments or scheduled data processing tasks), you can combine two Cron Jobs to achieve automatic shutdown and startup.

Typical Use Cases

  • Development Environment: Run only during weekdays from 09:00 to 18:00 and shut down outside these hours.

  • Data Processing Tasks: Start compute tasks between 02:00 and 04:00 daily.

  • Demo Systems: Operate only during customer viewing periods.

Creating a Shutdown Task

  1. Click the Add Cron Job button to create the first task.

  2. Configure the following parameters:

Task Name: dev-env-stop
Task Type: Scaling Applications at Launchpad
Cron Expression: 0 0 * * *  # Executes daily at 00:00 Singapore Time
App Name: your-app-name
Replica Count: 0
  1. Click Deploy to save the configuration.

Creating a Startup Task

  1. Click the Add Cron Job button again to create a second task.

  2. Configure the following parameters:

Task Name: dev-env-start
Task Type: Scaling Applications at Launchpad
Cron Expression: 0 9 * * *  # Executes daily at 09:00 Singapore Time
App Name: your-app-name
Replica Count: 3  # Restore to the normal number of instances
  1. Click Deploy to complete the configuration.

With this setup, the system will automatically:

  • Shut down instances every day at midnight, saving resources.

  • Restart the service every morning at 9:00, ensuring availability during working hours.

  • Operate continuously throughout the year without manual intervention.

Cron Job Configuration Entry
Cron Job Configuration Interface
Cron Job Shutdown Configuratio
Cron Job Startup Configuration