{"id":22394278,"url":"https://github.com/qrichert/cronrunner","last_synced_at":"2025-06-10T11:13:52.068Z","repository":{"id":187742992,"uuid":"677410077","full_name":"qrichert/cronrunner","owner":"qrichert","description":"Run cron jobs manually.","archived":false,"fork":false,"pushed_at":"2025-05-19T15:21:06.000Z","size":337,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-19T16:39:57.537Z","etag":null,"topics":["cli","cron","crontab","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/cronrunner","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qrichert.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,"zenodo":null}},"created_at":"2023-08-11T13:59:48.000Z","updated_at":"2025-05-17T18:43:18.000Z","dependencies_parsed_at":"2024-04-15T08:58:47.553Z","dependency_job_id":"aeedf09f-edf2-40ee-b7b7-c35921e17e0a","html_url":"https://github.com/qrichert/cronrunner","commit_stats":null,"previous_names":["qrichert/cronrunner"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qrichert%2Fcronrunner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qrichert%2Fcronrunner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qrichert%2Fcronrunner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qrichert%2Fcronrunner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qrichert","download_url":"https://codeload.github.com/qrichert/cronrunner/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qrichert%2Fcronrunner/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259063930,"owners_count":22799739,"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":["cli","cron","crontab","rust"],"created_at":"2024-12-05T05:09:36.550Z","updated_at":"2025-06-10T11:13:52.056Z","avatar_url":"https://github.com/qrichert.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cronrunner\n\n[![license (bin): GPL v3+](https://img.shields.io/badge/license-GPLv3+-blue)](https://www.gnu.org/licenses/gpl-3.0)\n[![license (lib): MIT](https://img.shields.io/badge/license-MIT-blue)](https://opensource.org/license/mit)\n![GitHub Tag](https://img.shields.io/github/v/tag/qrichert/cronrunner?sort=semver\u0026filter=*.*.*\u0026label=release)\n[![tokei (loc)](https://tokei.rs/b1/github/qrichert/cronrunner?label=loc\u0026style=flat)](https://github.com/XAMPPRocky/tokei)\n[![crates.io](https://img.shields.io/crates/d/cronrunner?logo=rust\u0026logoColor=white\u0026color=orange)](https://crates.io/crates/cronrunner)\n[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/qrichert/cronrunner/ci.yml?label=tests)](https://github.com/qrichert/cronrunner/actions)\n\n_Run cron jobs manually._[^1]\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./cronrunner.png\" alt=\"cronrunner\"\u003e\n\u003c/p\u003e\n\n```crontab\n# m h  dom mon dow   command\n\n@reboot /usr/bin/bash ~/startup.sh\n\n## Track disk space.\n30 4 * * * echo $(date) $(df -h | grep \"/dev/sda3\") \u003e\u003e .disk-space.txt\n\n## %{ignore} Stealthy job.\n* * * * * env \u003e ~/.cron.env\n\nFOO=:)\n0 12 * * * echo $FOO\n\n### Housekeeping\n\n## Prune dangling Docker images.\n@daily docker image prune --force\n```\n\n## Get `--help`\n\n```\nRun cron jobs manually.\n\nUsage: crn [OPTIONS] [ID]\n\nOptions:\n  -h, --help           Show this message and exit.\n  -v, --version        Show the version and exit.\n  -l, --list-only      List available jobs and exit.\n      --as-json        Render `--list-only` as JSON.\n  -s, --safe           Use job fingerprints.\n  -t, --tag \u003cTAG\u003e      Run specific tag.\n  -d, --detach         Run job in the background.\n  -e, --env \u003cFILE\u003e     Override job environment.\n```\n\n### Examples\n\nIf you know the ID of a job, you can run it directly:\n\n```console\n# Run job number 1.\n$ crn 1\nRunning...\n```\n\nIf the job takes a long time to run, you can detach it:\n\n```console\n# Prints the PID and exits.\n$ crn --detach 3\n1337\n$ _\n```\n\n### Extras\n\nComments that start with two hashes (`##`) and immediately precede a job\nare used as the description for that job.\n\n```crontab\n## Say hello.\n@hourly echo \"hello\"\n```\n\nThis job will be presented like this:\n\n```\n1. Say hello. @hourly echo \"hello\"\n```\n\nComments that start with three hashes (`###`) are used as section\nheaders, up until a new section starts or up until the end.\n\n```crontab\n### Housekeeping\n\n@daily docker image prune --force\n```\n\nThis job will be presented like this:\n\n```\nHousekeeping\n\n1. @daily docker image prune --force\n```\n\nDescriptions and sections are independent from one another.\n\n### Safe mode\n\nJob IDs are attributed in the order of appearance in the crontab. This\ncan be dangerous if used in scripts, because if the crontab changes, the\nwrong job may get run.\n\nInstead, you can activate `--safe` mode, in which jobs are identified by\na fingerprint. This is less user-friendly, but if the jobs get\nreordered, or if the command changes, that fingerprint will be\ninvalidated and the run will fail.\n\nOr, you could tag a specific job and run it with `--tag`. Tags are\nstable even if the underlying job changes. This is great for scripts,\nbut it does not guarantee that the command remains the same.\n\nTo define a tag, add a description comment starting with `%{...}`:\n\n```crontab\n## %{my-tag} Scriptable job.\n@reboot /usr/bin/bash ~/startup.sh\n```\n\nThen you can run it like this:\n\n```console\n$ crn --tag my-tag\nRunning...\n```\n\n### Ignore jobs\n\nTo ignore jobs, tag them with the special `%{ignore}` tag:\n\n```crontab\n## %{ignore} Ignored job.\n@daily /should/not/be/run/manually\n```\n\n### Environment\n\nCron runs jobs in a very minimalistic environment, which you may want to\nreplicate. The content of this environment is platform-specific and can\nvary a lot. The best way to capture it accurately is to export it\ndirectly from Cron. To do this, let Cron run this job once:\n\n```crontab\n## %{ignore}\n* * * * * env \u003e ~/.cron.env\n```\n\nThen, you can tell cronrunner to use this file as the environment for\nthe child process:\n\n```console\n$ crn --env ~/.cron.env 3\nRunning...\n```\n\n### Configuration\n\nSome arguments have corresponding environment variables, allowing you to\nset values permanently in a shell startup file (e.g., `~/.bashrc`).\n\n```\n--safe        CRONRUNNER_SAFE=1\n--env \u003cFILE\u003e  CRONRUNNER_ENV=\u003cFILE\u003e\n```\n\n### Tips\n\nIf you have jobs you only want to execute manually, you can schedule\nthem to run on February 31\u003csup\u003est\u003c/sup\u003e:\n\n```crontab\n0 0 31 2 * echo \"I never run on my own!\"\n```\n\n## Installation\n\n### Directly\n\n```console\n$ wget https://github.com/qrichert/cronrunner/releases/download/X.X.X/crn-X.X.X-xxx\n$ sudo install ./crn-* /usr/local/bin/crn\n```\n\n### Manual Build\n\n#### System-wide\n\n```console\n$ git clone https://github.com/qrichert/cronrunner.git\n$ cd cronrunner\n$ make build\n$ sudo make install\n```\n\n#### Through Cargo\n\n```shell\ncargo install cronrunner\ncargo install --git https://github.com/qrichert/cronrunner.git\n```\n\n## License\n\nThis project is dual-licensed:\n\n- The **binary** as a product is licensed under GPLv3+.\n- The **library** is available under the MIT license.\n\nIf you are using only the library in your own projects, you may use it\nunder the MIT license. However, if you are redistributing the binary or\na modified version of it, you must comply with GPLv3+.\n\n[^1]:\n    cronrunner used to be a Python project, see\n    [1.1.4](https://github.com/qrichert/cronrunner/tree/1.1.4).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqrichert%2Fcronrunner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqrichert%2Fcronrunner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqrichert%2Fcronrunner/lists"}