{"id":27323329,"url":"https://github.com/spinframework/spin-trigger-cron","last_synced_at":"2025-04-12T10:37:27.138Z","repository":{"id":210172435,"uuid":"725915401","full_name":"spinframework/spin-trigger-cron","owner":"spinframework","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-08T20:24:36.000Z","size":154,"stargazers_count":7,"open_issues_count":2,"forks_count":8,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-04-08T20:38:23.212Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spinframework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-01T06:15:50.000Z","updated_at":"2025-04-08T19:59:43.000Z","dependencies_parsed_at":"2024-05-12T21:24:40.292Z","dependency_job_id":"812f9bb3-25a5-4d9e-9fd8-effaf22c9280","html_url":"https://github.com/spinframework/spin-trigger-cron","commit_stats":null,"previous_names":["karthik2804/spin-trigger-cron","spinframework/spin-trigger-cron"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spinframework%2Fspin-trigger-cron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spinframework%2Fspin-trigger-cron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spinframework%2Fspin-trigger-cron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spinframework%2Fspin-trigger-cron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spinframework","download_url":"https://codeload.github.com/spinframework/spin-trigger-cron/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248555052,"owners_count":21123819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-12T10:37:25.231Z","updated_at":"2025-04-12T10:37:27.129Z","avatar_url":"https://github.com/spinframework.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Experimental Cron trigger for Spin\n\n## Install from release\n\n```bash\nspin plugins install --url https://github.com/fermyon/spin-trigger-cron/releases/download/canary/trigger-cron.json\n```\n\n## Build From source\n\nYou will need Rust and the `pluginify` plugin (`spin plugins install --url https://github.com/itowlson/spin-pluginify/releases/download/canary/pluginify.json`).\n\n```bash\ncargo build --release\nspin pluginify --install\n```\n\n## Test\n\nYou will need to build and run the spin components. Change the cron expression if needed.\n\n```bash\ncd guest\nspin build --up\n```\n\n\n## Installing the template \n\nYou can install the template using the following command:\n\n```bash\nspin templates install --git https://github.com/fermyon/spin-trigger-cron\n```\n\nOnce the template is installed, you can create a new application using:\n\n```bash\nspin new -t cron-rust hello_cron --accept-defaults\n```\n\nTo run the newly created app:\n\n```\ncd hello_cron\nspin build --up\n```\n\n## Trigger Configuration\n\nThe trigger type is `cron`, and there are no application-level configuration options. \n\nThe following options are available to set in the [[trigger.cron]] section:\n\n| Name                  | Type             | Required? | Description |\n|-----------------------|------------------|-----------|-------------|\n| `component`           | string or table  | required  | The component to run on the schedule given in `cron_expression`. (This is the standard Spin trigger component field.) |\n| `cron_expression`     | string           | required  | The `cron` expression describes the schedule for executing the component. |\n\n### Cron Expression Fields\n\nThe `cron_expression` fields are as follows:\n\n```text\n#  ┌──────────── sec (0–59)\n#  |  ┌───────────── min (0–59)\n#  |  │  ┌───────────── hour (0–23)\n#  |  │  │  ┌───────────── day of month (1–31)\n#  |  │  │  │  ┌───────────── month (1–12)\n#  |  │  │  │  │  ┌───────────── day of week (0–6)\n#  |  │  │  │  │  |  ┌─────────────- year\n#  |  │  │  │  │  |  │\n#  |  │  │  │  │  |  │\n   *  *  *  *  *  *  * \n```\n\n### Cron Expression Characters\n\nThe `*` indicates that every value applies. For example, if `sec` is set to `*`, then every second will trigger execution.\nThe `/` indicates increments. For example, if `sec` is set to `0/15`, then starting at `0`, the trigger will be executed every 15 seconds.\nThe `,` indicates a list of values. For example, if `sec` is set to `2,8`, then the trigger will execute only on the 2nd and 8th seconds of every minute.\nThe `-` indicates range. For example, if the `sec` is set to `5-10`, then the trigger will execute only on the 5th, 6th, 7th, 8th, 9th, and 10th seconds of each minute.\nThe `0` indicates no execution. If the `sec` is set to `0`, then the trigger can only execute on higher field values such as `min`, `hour`, etc. The lowest second increment is 60 (one minute).\n\nHere is one example that combines a few of the fields mentioned above:\n\n```text\nsec   min   hour   day of month   month   day of week   year\n0     1/2   11,12  5-10           *       *             *\n```\n\nThe above schedule of `0 1/2 11,12 5-10 * * *` will execute on the first minute and every subsequent 2 minutes during the 11th hour and the 12 hour (noon) on days 5 through 10 of every month (regardless of the day of the week) and this will repeat through every year.\n\n## Building Cron Components\n\nCurrently only a Rust SDK is supported for guest components. The `spin-cron-sdk` along with the [`spin_sdk` crate](https://docs.rs/spin-sdk) can be used to build cron components. The guest code must have a function decorated with the `#[cron_component]` macro. See `guest/src/lib.rs` for an example in rust. \n\nThe signature of the function must be `fn handle_cron_event(metadata: Metadata) -\u003e Result\u003c(), Error\u003e`.\n\nThe `Metadata` object contains a single field `timestamp` which contains the duration since 00:00:00 UTC on 1 January 1970 (the Unix epoch) in seconds.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspinframework%2Fspin-trigger-cron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspinframework%2Fspin-trigger-cron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspinframework%2Fspin-trigger-cron/lists"}