{"id":21577831,"url":"https://github.com/foxzool/bevy_cronjob","last_synced_at":"2025-04-10T17:29:38.388Z","repository":{"id":185504406,"uuid":"673658286","full_name":"foxzool/bevy_cronjob","owner":"foxzool","description":"A simple helper to run cronjobs (at repeated schedule) in Bevy.","archived":false,"fork":false,"pushed_at":"2025-03-24T05:11:42.000Z","size":132,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T15:11:11.247Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/foxzool.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","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-08-02T06:14:15.000Z","updated_at":"2025-03-24T05:11:46.000Z","dependencies_parsed_at":"2024-10-23T08:32:21.989Z","dependency_job_id":"6f8fed3d-93dd-4b47-b0dc-6e448c3f12ee","html_url":"https://github.com/foxzool/bevy_cronjob","commit_stats":null,"previous_names":["foxzool/bevy_cronjob"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxzool%2Fbevy_cronjob","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxzool%2Fbevy_cronjob/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxzool%2Fbevy_cronjob/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxzool%2Fbevy_cronjob/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foxzool","download_url":"https://codeload.github.com/foxzool/bevy_cronjob/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248261986,"owners_count":21074229,"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":"2024-11-24T13:08:45.562Z","updated_at":"2025-04-10T17:29:38.383Z","avatar_url":"https://github.com/foxzool.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![crates.io](https://img.shields.io/crates/v/bevy_cronjob)](https://crates.io/crates/bevy_cronjob)\n[![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](https://github.com/Seldom-SE/seldom_pixel#license)\n[![CI](https://github.com/foxzool/bevy_cronjob/workflows/CI/badge.svg)](https://github.com/foxzool/bevy_cronjob/actions)\n[![Documentation](https://docs.rs/bevy_cronjob/badge.svg)](https://docs.rs/bevy_cronjob)\n\n# bevy_cronjob\n\n`bevy_cronjob` is a simple helper to run cronjob (at repeated schedule) in Bevy.\n\n## Usage\n\n``` rust, no_run\nuse bevy::log::LogPlugin;\nuse bevy::prelude::*;\nuse bevy_app::ScheduleRunnerPlugin;\nuse bevy_cronjob::prelude::*;\nuse std::time::Duration;\n\nfn main() {\n    App::new()\n        .add_plugins(\n            MinimalPlugins.set(ScheduleRunnerPlugin::run_loop(Duration::from_secs_f64(\n                1.0 / 60.0,\n            ))),\n        )\n        .add_plugins(LogPlugin::default())\n        .add_plugins(CronJobPlugin)\n        .add_systems(Startup, setup)\n        .add_systems(\n            Update,\n            print_per_5_sec.run_if(schedule_passed(\"every 5 seconds\")),\n        )\n        .add_systems(\n            Update,\n            print_per_min.run_if(schedule_passed(\"every 1 minute\")),\n        )\n        .add_systems(Update, print_per_hour.run_if(schedule_passed(\"every hour\")))\n        .run();\n}\n\nfn print_per_5_sec() {\n    info!(\"system run every 5 sec\")\n}\n\nfn print_per_min() {\n    info!(\"system run every minute\")\n}\n\nfn print_per_hour() {\n    info!(\"system run every hour\")\n}\n\nfn setup(mut commands: Commands) {\n    commands\n        .spawn(ScheduleTimer::new(\"every 3 seconds\"))\n        .observe(|_: Trigger\u003cScheduleArrived\u003e| {\n            info!(\"3 seconds passed\");\n        });\n}\n\n```\n\n## Expression\n\nthe scheduling expression is base on [cron](https://github.com/zslayton/cron)\n\n| sec  | min  | hour | day of month | month | day of week | year      |\n|------|------|------|--------------|-------|-------------|-----------|\n| *    | *    | *    | *            | *     | *           | *         |\n| 0-59 | 0-59 | 0-23 | 1-23         | 1-12  | 1-7         | 1970-2100 |\n\nTime is specified in UTC. Note that the year may be omitted.\n\nComma separated values such as `1,2,3` are allowed. For example, a schedule of `0,15,30,45 * * * * *`' would execute on\nevery 15 seconds.\n\nRanges can be specified with a dash. For example `1-5 * * * * *`' would execute on every second for the first 5 seconds\nof a minute.\n\n## Full List of Supported English Patterns\n\nsupported by [english-to-cron](https://github.com/kaplanelad/english-to-cron)\n\n| English Phrase                                   | CronJob Syntax   |\n|--------------------------------------------------|------------------|\n| every 15 seconds                                 | 0/15 * * * * ? * |\n| run every minute                                 | 0 * * * * ? *    |\n| fire every day at 4:00 pm                        | 0 0 16 */1 * ? * |\n| at 10:00 am                                      | 0 0 10 * * ? *   |\n| run at midnight on the 1st and 15th of the month | 0 0 0 1,15 * ? * |\n| On Sunday at 12:00                               | 0 0 12 ? * SUN * |\n| 7pm every Thursday                               | 0 0 19 ? * THU * |\n| midnight on Tuesdays                             | 0 0 ? * TUE *    |\n\n## Supported Versions\n\n| bevy | bevy_cronjob |\n|------|--------------|\n| 0.15 | 0.5          |\n| 0.14 | 0.4          |\n| 0.13 | 0.3          |\n| 0.12 | 0.2          |\n| 0.11 | 0.1          |\n\n## License\n\nDual-licensed under either\n\n- MIT\n- Apache 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxzool%2Fbevy_cronjob","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoxzool%2Fbevy_cronjob","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxzool%2Fbevy_cronjob/lists"}