{"id":13586308,"url":"https://github.com/gjcarneiro/yacron","last_synced_at":"2025-10-21T19:40:31.317Z","repository":{"id":38816641,"uuid":"97506953","full_name":"gjcarneiro/yacron","owner":"gjcarneiro","description":"A modern Cron replacement that is Docker-friendly","archived":false,"fork":false,"pushed_at":"2024-03-23T19:06:10.000Z","size":365,"stargazers_count":468,"open_issues_count":14,"forks_count":41,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-09-24T06:43:42.162Z","etag":null,"topics":["asyncio","cron","docker","python","yaml"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gjcarneiro.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","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":"2017-07-17T18:04:02.000Z","updated_at":"2025-08-31T18:00:53.000Z","dependencies_parsed_at":"2024-06-08T20:12:18.197Z","dependency_job_id":null,"html_url":"https://github.com/gjcarneiro/yacron","commit_stats":{"total_commits":277,"total_committers":16,"mean_commits":17.3125,"dds":0.4981949458483754,"last_synced_commit":"2461cdc164745faf22d29e185c8a8d6918091439"},"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"purl":"pkg:github/gjcarneiro/yacron","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gjcarneiro%2Fyacron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gjcarneiro%2Fyacron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gjcarneiro%2Fyacron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gjcarneiro%2Fyacron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gjcarneiro","download_url":"https://codeload.github.com/gjcarneiro/yacron/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gjcarneiro%2Fyacron/sbom","scorecard":{"id":428679,"data":{"date":"2025-08-11","repo":{"name":"github.com/gjcarneiro/yacron","commit":"bde0f0b73d227636adf40d849fd281451136c476"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/tox.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":1,"reason":"Found 3/25 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact 0.19.0 not signed: https://api.github.com/repos/gjcarneiro/yacron/releases/95284873","Warn: release artifact 0.18.0 not signed: https://api.github.com/repos/gjcarneiro/yacron/releases/87661965","Warn: release artifact 0.17.0 not signed: https://api.github.com/repos/gjcarneiro/yacron/releases/70580655","Warn: release artifact 0.16.0 not signed: https://api.github.com/repos/gjcarneiro/yacron/releases/54657895","Warn: release artifact 0.15.1 not signed: https://api.github.com/repos/gjcarneiro/yacron/releases/53711864","Warn: release artifact 0.19.0 does not have provenance: https://api.github.com/repos/gjcarneiro/yacron/releases/95284873","Warn: release artifact 0.18.0 does not have provenance: https://api.github.com/repos/gjcarneiro/yacron/releases/87661965","Warn: release artifact 0.17.0 does not have provenance: https://api.github.com/repos/gjcarneiro/yacron/releases/70580655","Warn: release artifact 0.16.0 does not have provenance: https://api.github.com/repos/gjcarneiro/yacron/releases/54657895","Warn: release artifact 0.15.1 does not have provenance: https://api.github.com/repos/gjcarneiro/yacron/releases/53711864"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tox.yml:7: update your workflow using https://app.stepsecurity.io/secureworkflow/gjcarneiro/yacron/tox.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tox.yml:8: update your workflow using https://app.stepsecurity.io/secureworkflow/gjcarneiro/yacron/tox.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tox.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/gjcarneiro/yacron/tox.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tox.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/gjcarneiro/yacron/tox.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tox.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/gjcarneiro/yacron/tox.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tox.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/gjcarneiro/yacron/tox.yml/master?enable=pin","Warn: containerImage not pinned by hash: example/docker/Dockerfile:1: pin your Docker image by updating ubuntu:xenial to ubuntu:xenial@sha256:1f1a2d56de1d604801a9671f301190704c25d604a416f59e03c04f5c6ffee0d6","Warn: containerImage not pinned by hash: pyinstaller/Dockerfile:1: pin your Docker image by updating ubuntu:20.04 to ubuntu:20.04@sha256:8feb4d8ca5354def3d8fce243717141ce31e2c428701f6682bd2fafe15388214","Warn: pipCommand not pinned by hash: example/docker/Dockerfile:6-7","Warn: downloadThenRun not pinned by hash: pyinstaller/Dockerfile:8","Warn: pipCommand not pinned by hash: pyinstaller/Dockerfile:18","Warn: pipCommand not pinned by hash: .github/workflows/tox.yml:19","Warn: pipCommand not pinned by hash: .github/workflows/tox.yml:20","Warn: pipCommand not pinned by hash: .github/workflows/tox.yml:35","Warn: pipCommand not pinned by hash: .github/workflows/tox.yml:36","Warn: pipCommand not pinned by hash: .github/workflows/tox.yml:10","Warn: pipCommand not pinned by hash: .github/workflows/tox.yml:11","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 downloadThenRun dependencies pinned","Info:   0 out of   2 containerImage dependencies pinned","Info:   0 out of   8 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Vulnerabilities","score":0,"reason":"11 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2023-120 / GHSA-45c4-8wx5-qw6w","Warn: Project is vulnerable to: PYSEC-2024-24 / GHSA-5h86-8mv2-jq9f","Warn: Project is vulnerable to: GHSA-5m98-qgg9-wh84","Warn: Project is vulnerable to: GHSA-7gpw-8wmc-pm8g","Warn: Project is vulnerable to: GHSA-8495-4g3g-x7pr","Warn: Project is vulnerable to: PYSEC-2024-26 / GHSA-8qpw-xqxj-h4r2","Warn: Project is vulnerable to: GHSA-9548-qrrj-x5pj","Warn: Project is vulnerable to: PYSEC-2023-246 / GHSA-gfw2-4jvh-wgfg","Warn: Project is vulnerable to: GHSA-pjjw-qhg8-p2p9","Warn: Project is vulnerable to: PYSEC-2023-250 / GHSA-q3qx-c6g2-7pw2","Warn: Project is vulnerable to: PYSEC-2023-251 / GHSA-qvrw-v9rv-5rjx"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 9 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T02:49:32.807Z","repository_id":38816641,"created_at":"2025-08-19T02:49:32.807Z","updated_at":"2025-08-19T02:49:32.807Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280325184,"owners_count":26311414,"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","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["asyncio","cron","docker","python","yaml"],"created_at":"2024-08-01T15:05:27.864Z","updated_at":"2025-10-21T19:40:31.300Z","avatar_url":"https://github.com/gjcarneiro.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"================\nYet Another Cron\n================\n\n\nA modern Cron replacement that is Docker-friendly\n\n\n* Free software: MIT license\n\nFeatures\n--------\n\n* \"Crontab\" is in YAML format;\n* Builtin sending of Sentry and Mail outputs when cron jobs fail;\n* Flexible configuration: you decide how to determine if a cron job fails or not;\n* Designed for running in Docker, Kubernetes, or 12 factor environments:\n\n  * Runs in the foreground;\n  * Logs everything to stdout/stderr [1]_;\n\n* Option to automatically retry failing cron jobs, with exponential backoff;\n* Optional HTTP REST API, to fetch status and start jobs on demand;\n* Arbitrary timezone support;\n\n\n.. [1] Whereas vixie cron only logs to syslog, requiring a syslog daemon to be running in the background or else you don't get logs!\n\nStatus\n--------------\n\nThe project is in beta stage: essential features are complete, and the focus is\nfinding and fixing bugs before the first stable release.\n\nInstallation\n------------\n\nInstall using pip\n+++++++++++++++++\n\nyacron requires Python \u003e= 3.6 (for systems with older Python, use the binary instead).  It is advisable to install it in a Python\nvirtual environment, for example:\n\n.. code-block:: shell\n\n    python3 -m venv yacronenv\n    . yacronenv/bin/activate\n    pip install yacron\n\nInstall using pipx\n++++++++++++++++++\n\npipx_ automates creating a virtualenv and installing a python program in the\nnewly created virtualenv.  It is as simple as:\n\n.. code-block:: shell\n\n    pipx install yacron\n\n.. _pipx: https://github.com/pipxproject/pipx\n\nInstall using binary\n++++++++++++++++++++\n\nAlternatively, a self-contained binary can be downloaded\nfrom github: https://github.com/gjcarneiro/yacron/releases. This binary should\nwork on any Linux 64-bit system post glibc 2.23 (e.g. Ubuntu:16.04).  Python is not required on the target system (it is embedded in the executable).\n\nUsage\n-----\n\nConfiguration is in YAML format.  To start yacron, give it a configuration file\nor directory path as the ``-c`` argument.  For example::\n\n    yacron -c /tmp/my-crontab.yaml\n\nThis starts yacron (always in the foreground!), reading\n``/tmp/my-crontab.yaml`` as configuration file.  If the path is a directory,\nany ``*.yaml`` or ``*.yml`` files inside this directory are taken as\nconfiguration files.\n\nConfiguration basics\n++++++++++++++++++++\n\nThis configuration runs a command every 5 minutes:\n\n.. code-block:: yaml\n\n    jobs:\n      - name: test-01\n        command: echo \"foobar\"\n        shell: /bin/bash\n        schedule: \"*/5 * * * *\"\n\nThe command can be a string or a list of strings.  If command is a string,\nyacron runs it through a shell, which is ``/bin/bash`` in the above example, but\nis ``/bin/sh`` by default.\n\nIf the command is a list of strings, the command is executed directly, without a\nshell.  The ARGV of the command to execute is extracted directly from the\nconfiguration:\n\n.. code-block:: yaml\n\n    jobs:\n      - name: test-01\n        command:\n          - echo\n          - foobar\n        schedule: \"*/5 * * * *\"\n\n\nThe `schedule` option can be a string in a crontab format specified by https://github.com/josiahcarlson/parse-crontab (this module is used by yacron).\nAdditionally @reboot can be included , which will only run the job when yacron is initially\nexecuted. Further `schedule` can be an object with properties.  The following configuration\nruns a command every 5 minutes, but only on the specific date 2017-07-19, and\ndoesn't run it in any other date:\n\n.. code-block:: yaml\n\n    jobs:\n      - name: test-01\n        command: echo \"foobar\"\n        schedule:\n          minute: \"*/5\"\n          dayOfMonth: 19\n          month: 7\n          year: 2017\n          dayOfWeek: \"*\"\n\nImportant: by default all time is interpreted to be in UTC, but you can\nrequest to use local time instead.  For instance, the cron job below runs\nevery day at 19h27 *local time* because of the ``utc: false`` option:\n\n.. code-block:: yaml\n\n  jobs:\n    - name: test-01\n      command: echo \"hello\"\n      schedule: \"27 19 * * *\"\n      utc: false\n      captureStdout: true\n\nSince Yacron version 0.11, you can also request that the schedule be\ninterpreted in an arbitrary timezone, using the ``timezone`` attribute:\n\n.. code-block:: yaml\n\n  jobs:\n    - name: test-01\n      command: echo \"hello\"\n      schedule: \"27 19 * * *\"\n      timezone: America/Los_Angeles\n      captureStdout: true\n\n\nYou can ask for environment variables to be defined for command execution:\n\n.. code-block:: yaml\n\n    jobs:\n      - name: test-01\n        command: echo \"foobar\"\n        shell: /bin/bash\n        schedule: \"*/5 * * * *\"\n        environment:\n          - key: PATH\n            value: /bin:/usr/bin\n\nYou can also provide an environment file to define environments for command execution:\n\n.. code-block:: yaml\n\n    jobs:\n      - name: test-01\n        command: echo \"foobar\"\n        shell: /bin/bash\n        schedule: \"*/5 * * * *\"\n        env_file: .env\n\nThe env file must be a list of ``KEY=VALUE`` pairs. Empty lines and lines starting with ``#`` will be ignored.\n\nVariables declared in the ``environment`` option will override those found in the ``env_file``.\n\n\nSpecifying defaults\n+++++++++++++++++++\n\n\nThere can be a special ``defaults`` section in the config.  Any attributes\ndefined in this section provide default values for cron jobs to inherit.\nAlthough cron jobs can still override the defaults, as needed:\n\n.. code-block:: yaml\n\n    defaults:\n        environment:\n          - key: PATH\n            value: /bin:/usr/bin\n        shell: /bin/bash\n        utc: false\n    jobs:\n      - name: test-01\n        command: echo \"foobar\"  # runs with /bin/bash as shell\n        schedule: \"*/5 * * * *\"\n      - name: test-02  # runs with /bin/sh as shell\n        command: echo \"zbr\"\n        shell: /bin/sh\n        schedule: \"*/5 * * * *\"\n\nNote: if the configuration option is a directory and there are multiple configuration files in that directory, then the ``defaults`` section in each configuration file provides default options only for cron jobs inside that same file; the defaults have no effect beyond any individual YAML file.\n\nReporting\n+++++++++\n\nYacron has builtin support for reporting jobs failure (more on that below) by\nemail, Sentry and shell command (additional reporting methods might be added in the future):\n\n.. code-block:: yaml\n\n  - name: test-01\n    command: |\n      echo \"hello\" 1\u003e\u00262\n      sleep 1\n      exit 10\n    schedule:\n      minute: \"*/2\"\n    captureStderr: true\n    onFailure:\n      report:\n        sentry:\n          dsn:\n            value: example\n            # Alternatively:\n            # fromFile: /etc/secrets/my-secret-dsn\n            # fromEnvVar: SENTRY_DSN\n          fingerprint:  # optional, since yacron 0.6\n            - yacron\n            - \"{{ environment.HOSTNAME }}\"\n            - \"{{ name }}\"\n          extra:\n            foo: bar\n            zbr: 123\n          level: warning\n          environment: production\n        mail:\n          from: example@foo.com\n          to: example@bar.com\n          smtpHost: 127.0.0.1\n          # optional fields:\n          username: \"username1\"  # set username and password to enable login\n          password:\n            value: example\n            # Alternatively:\n            # fromFile: /etc/secrets/my-secret-password\n            # fromEnvVar: MAIL_PASSWORD\n          tls: false  # set to true to enable TLS\n          starttls: false  # set to true to enable StartTLS\n        shell:\n          shell: /bin/bash\n          command: ...\n\nHere, the ``onFailure`` object indicates that what to do when a job failure\nis detected.  In this case we ask for it to be reported both to sentry and by\nsending an email.\n\nThe ``captureStderr: true`` part instructs yacron to capture output from the the\nprogram's `standard error`, so that it can be included in the report.  We could\nalso turn on `standard output` capturing via the ``captureStdout: true`` option.\nBy default, yacron captures only standard error.  If a cron job's standard error\nor standard output capturing is not enabled, these streams will simply write to\nthe same standard output and standard error as yacron itself.\n\nBoth `stdout` and `stderr` stream lines are by default prefixed with\n``[{job_name} {stream_name}]``, i.e. ``[test-01 stdout]``, if for any reason you\nneed to change this, provide the option ``streamPrefix`` (new in version 0.16)\nwith your own custom string.\n\n.. code-block:: yaml\n\n  - name: test-01\n    command: echo \"hello world\"\n    schedule:\n      minute: \"*/2\"\n    captureStdout: true\n    streamPrefix: \"[{job_name} job]\"\n\nIn some cases, for instance when you're logging JSON objects you might want to\ncompletely get rid of the prefix altogether:\n\n.. code-block:: yaml\n\n  - name: test-01\n    command: echo \"hello world\"\n    schedule:\n      minute: \"*/2\"\n    captureStdout: true\n    streamPrefix: \"\"\n\nIt is possible also to report job success, as well as failure, via the\n``onSuccess`` option.\n\n.. code-block:: yaml\n\n  - name: test-01\n    command: echo \"hello world\"\n    schedule:\n      minute: \"*/2\"\n    captureStdout: true\n    onSuccess:\n      report:\n        mail:\n          from: example@foo.com\n          to: example@bar.com\n          smtpHost: 127.0.0.1\n\nSince yacron 0.5, it is possible to customise the format of the report. For\n``mail`` reporting, the option ``subject`` indicates what is the subject of the\nemail, while ``body`` formats the email body.  For Sentry reporting, there is\nonly ``body``.  In all cases, the values of those options are strings that are\nprocessed by the jinja2_ templating engine.  The following variables are\navailable in templating:\n\n* name(str): name of the cron job\n* success(bool): whether or not the cron job succeeded\n* stdout(str): standard output of the process\n* stderr(str): standard error of the process\n* exit_code(int): process exit code\n* command(str): cron job command\n* shell(str): cron job shell\n* environment(dict): subprocess environment variables\n\n.. _jinja2: http://jinja.pocoo.org/\n\nExample:\n\n.. code-block:: yaml\n\n  - name: test-01\n    command: |\n      echo \"hello\" 1\u003e\u00262\n      sleep 1\n      exit 10\n    schedule:\n      minute: \"*/2\"\n    captureStderr: true\n    onFailure:\n      report:\n        mail:\n          from: example@foo.com\n          to: example@bar.com\n          smtpHost: 127.0.0.1\n          subject: Cron job '{{name}}' {% if success %}completed{% else %}failed{% endif %}\n          body: |\n            {{stderr}}\n            (exit code: {{exit_code}})\n\n\nThe shell reporter (since yacron 0.13) executes a user given shell command in\nthe specified shell. It passes all environment variables from the python\nexecutable and specifies some additional ones to inform about the state of the\njob:\n\n* YACRON_FAIL_REASON (str)\n* YACRON_FAILED (\"1\" or \"0\")\n* YACRON_JOB_NAME (str)\n* YACRON_JOB_COMMAND (str)\n* YACRON_JOB_SCHEDULE (str)\n* YACRON_RETCODE (str)\n* YACRON_STDERR (str)\n* YACRON_STDOUT (str)\n\nA simple example configuration:\n\n.. code-block:: yaml\n\n  - name: test-01\n    command: echo \"foobar\" \u0026\u0026 exit 123\n    shell: /bin/bash\n    schedule: \"* * * * *\"\n    onFailure:\n      report:\n        shell:\n          shell: /bin/bash\n          command: echo \"Error code $YACRON_RETCODE\"\n\nSince yacron 0.15, it is possible to send emails formatted as html, by  adding\nthe ``html: true`` property.  For example, here the standard output of a shell\ncommand is captured and interpreted as html and placed in the email message\\:\n\n.. code-block:: yaml\n\n  - name: test-01\n    command: echo \"hello \u003cb\u003eworld\u003c/b\u003e\"\n    schedule: \"@reboot\"\n    captureStdout: true\n    onSuccess:\n      report:\n        mail:\n          from: example@foo.com\n          to: example@bar.com, zzz@sleep.com\n          html: true\n          smtpHost: 127.0.0.1\n          smtpPort: 1025\n          subject: This is a cron job with html body\n\n\nMetrics\n+++++++++\n\nYacron has builtin support for writing job metrics to Statsd_:\n\n.. _Statsd: https://github.com/etsy/statsd\n\n.. code-block:: yaml\n\n    jobs:\n      - name: test01\n        command: echo \"hello\"\n        schedule: \"* * * * *\"\n        statsd:\n          host: my-statsd.example.com\n          port: 8125\n          prefix: my.cron.jobs.prefix.test01\n\nWith this config Yacron will write the following metrics over UDP\nto the Statsd listening on ``my-statsd.example.com:8125``:\n\n.. code-block::\n\n  my.cron.jobs.prefix.test01.start:1|g  # this one is sent when the job starts\n  my.cron.jobs.prefix.test01.stop:1|g   # the rest are sent when the job stops\n  my.cron.jobs.prefix.test01.success:1|g\n  my.cron.jobs.prefix.test01.duration:3|ms|@0.1\n\n\nHandling failure\n++++++++++++++++\n\nBy default, yacron considers that a job has `failed` if either the process\nreturns a non-zero code or if it generates output to `standard error` (and\nstandard error capturing is enabled, of course).\n\nYou can instruct yacron how to determine if a job has failed or not via the\n``failsWhen`` option:\n\n.. code-block:: yaml\n\n  failsWhen:\n    producesStdout: false\n    producesStderr: true\n    nonzeroReturn: true\n    always: false\n\nproducesStdout\n    If true, any captured standard output causes yacron to consider the job\n    as failed.  This is false by default.\n\nproducesStderr\n    If true, any captured standard error causes yacron to consider the job\n    as failed.  This is true by default.\n\nnonzeroReturn\n    If true, if the job process returns a code other than zero causes yacron\n    to consider the job as failed.  This is true by default.\n\nalways\n    If true, if the job process exits that causes yacron to consider the job as\n    failed.  This is false by default.\n\nIt is possible to instruct yacron to retry failing cron jobs by adding a\n``retry`` option inside ``onFailure``:\n\n.. code-block:: yaml\n\n  - name: test-01\n    command: |\n      echo \"hello\" 1\u003e\u00262\n      sleep 1\n      exit 10\n    schedule:\n      minute: \"*/10\"\n    captureStderr: true\n    onFailure:\n      report:\n        mail:\n          from: example@foo.com\n          to: example@bar.com\n          smtpHost: 127.0.0.1\n      retry:\n        maximumRetries: 10\n        initialDelay: 1\n        maximumDelay: 30\n        backoffMultiplier: 2\n\nThe above settings tell yacron to retry the job up to 10 times, with the delay\nbetween retries defined by an exponential backoff process: initially 1 second,\ndoubling for every retry up to a maximum of 30 seconds. A value of -1 for\nmaximumRetries will mean yacron will keep retrying forever, this is mostly\nuseful with a schedule of \"@reboot\" to restart a long running process when it\nhas failed.\n\nIf the cron job is expected to fail sometimes, you may wish to report only in\nthe case the cron job ultimately fails after all retries and we give up on it.\nFor that situation, you can use the ``onPermanentFailure`` option:\n\n.. code-block:: yaml\n\n  - name: test-01\n    command: |\n      echo \"hello\" 1\u003e\u00262\n      sleep 1\n      exit 10\n    schedule:\n      minute: \"*/10\"\n    captureStderr: true\n    onFailure:\n      retry:\n        maximumRetries: 10\n        initialDelay: 1\n        maximumDelay: 30\n        backoffMultiplier: 2\n    onPermanentFailure:\n      report:\n        mail:\n          from: example@foo.com\n          to: example@bar.com\n          smtpHost: 127.0.0.1\n\nConcurrency\n+++++++++++\nSometimes it may happen that a cron job takes so long to execute that when the moment its next scheduled execution is reached a previous instance may still be running.  How yacron handles this situation is controlled by the option ``concurrencyPolicy``, which takes one of the following values:\n\nAllow\n    allows concurrently running jobs (default)\nForbid\n    forbids concurrent runs, skipping next run if previous hasn’t finished yet\nReplace\n    cancels currently running job and replaces it with a new one\n\nExecution timeout\n+++++++++++++++++\n\n(new in version 0.4)\n\nIf you have a cron job that may possibly hang sometimes, you can instruct yacron\nto terminate the process after N seconds if it's still running by then, via the\n``executionTimeout`` option.  For example, the following cron job takes 2\nseconds to complete, yacron will terminate it after 1 second:\n\n.. code-block:: yaml\n\n  - name: test-03\n    command: |\n      echo \"starting...\"\n      sleep 2\n      echo \"all done.\"\n    schedule:\n      minute: \"*\"\n    captureStderr: true\n    executionTimeout: 1  # in seconds\n\nWhen terminating a job, it is always a good idea to give that job process some\ntime to terminate properly.  For example, it may have opened a file, and even if\nyou tell it to shutdown, the process may need a few seconds to flush buffers and\navoid losing data.\n\nOn the other hand, there are times when programs are buggy and simply get stuck,\nrefusing to terminate nicely no matter what.  For this reason, yacron always\nchecks if a process exited some time after being asked to do so. If it hasn't,\nit tries to forcefully kill the process.  The option ``killTimeout`` option\nindicates how many seconds to wait for the process to gracefully terminate\nbefore killing it more forcefully.  In Unix systems, we first send a SIGTERM,\nbut if the process doesn't exit after ``killTimeout`` seconds (30 by default)\nthen we send SIGKILL.  For example, this cron job ignores SIGTERM, and so yacron\nwill send it a SIGKILL after half a second:\n\n.. code-block:: yaml\n\n  - name: test-03\n    command: |\n      trap \"echo '(ignoring SIGTERM)'\" TERM\n      echo \"starting...\"\n      sleep 10\n      echo \"all done.\"\n    schedule:\n      minute: \"*\"\n    captureStderr: true\n    executionTimeout: 1\n    killTimeout: 0.5\n\nChange to another user/group\n++++++++++++++++++++++++++++\n\n(new in version 0.11)\n\nYou can request that Yacron change to another user and/or group for a specific\ncron job.  The field ``user`` indicates the user (uid or userame) under which\nthe subprocess must be executed.  The field ``group`` (gid or group name)\nindicates the group id.  If only ``user`` is given, the group defaults to the\nmain group of that user.  Example:\n\n.. code-block:: yaml\n\n  - name: test-03\n    command: id\n    schedule:\n      minute: \"*\"\n    captureStderr: true\n    user: www-data\n\nNaturally, yacron must be running as root in order to have permissions to\nchange to another user.\n\n\nRemote web/HTTP interface\n+++++++++++++++++++++++++\n\n(new in version 0.10)\n\nIf you wish to remotely control yacron, you can optionally enable an HTTP REST\ninterface, with the following configuration (example):\n\n.. code-block:: yaml\n\n  web:\n    listen:\n       - http://127.0.0.1:8080\n       - unix:///tmp/yacron.sock\n\nNow you have the following options to control it (using HTTPie as example):\n\nGet the version of yacron:\n##########################\n\n.. code-block:: shell\n\n  $ http get http://127.0.0.1:8080/version\n  HTTP/1.1 200 OK\n  Content-Length: 22\n  Content-Type: text/plain; charset=utf-8\n  Date: Sun, 03 Nov 2019 19:48:15 GMT\n  Server: Python/3.7 aiohttp/3.6.2\n\n  0.10.0b3.dev7+g45bc4ce\n\nGet the status of cron jobs:\n############################\n\n.. code-block:: shell\n\n  $ http get http://127.0.0.1:8080/status\n  HTTP/1.1 200 OK\n  Content-Length: 104\n  Content-Type: text/plain; charset=utf-8\n  Date: Sun, 03 Nov 2019 19:44:45 GMT\n  Server: Python/3.7 aiohttp/3.6.2\n\n  test-01: scheduled (in 14 seconds)\n  test-02: scheduled (in 74 seconds)\n  test-03: scheduled (in 14 seconds)\n\nYou may also get status info in json format:\n\n.. code-block:: shell\n\n  $ http get http://127.0.0.1:8080/status Accept:application/json\n  HTTP/1.1 200 OK\n  Content-Length: 206\n  Content-Type: application/json; charset=utf-8\n  Date: Sun, 03 Nov 2019 19:45:53 GMT\n  Server: Python/3.7 aiohttp/3.6.2\n\n  [\n      {\n          \"job\": \"test-01\",\n          \"scheduled_in\": 6.16588,\n          \"status\": \"scheduled\"\n      },\n      {\n          \"job\": \"test-02\",\n          \"scheduled_in\": 6.165787,\n          \"status\": \"scheduled\"\n      },\n      {\n          \"job\": \"test-03\",\n          \"scheduled_in\": 6.165757,\n          \"status\": \"scheduled\"\n      }\n  ]\n\nStart a job right now:\n######################\n\nSometimes it's useful to start a cron job right now, even if it's not\nscheduled to run yet, for example for testing:\n\n.. code-block:: shell\n\n  $ http post http://127.0.0.1:8080/jobs/test-02/start\n  HTTP/1.1 200 OK\n  Content-Length: 0\n  Content-Type: application/octet-stream\n  Date: Sun, 03 Nov 2019 19:50:20 GMT\n  Server: Python/3.7 aiohttp/3.6.2\n\n\nIncludes\n++++++++\n\n(new in version 0.13)\n\nYou may have a use case where it's convenient to have multiple config files,\nand choose at runtime which one to use.  In that case, it might be useful if\nyou can put common definitions (such as defaults for reporting, shell, etc.)\nin a separate file, that is included by the other files.\n\nTo support this use case, it is possible to ask one config file to include\nanother one, via the ``include`` directive.  It takes a list of file names:\nthose files will be parsed as configuration and merged in with this file.\n\nExample, your main config file could be:\n\n.. code-block:: yaml\n\n  include:\n    - _inc.yaml\n\n  jobs:\n\n    - name: my job\n      ...\n\nAnd your included ``_inc.yaml`` file could contain some useful defaults:\n\n\n.. code-block:: yaml\n\n  defaults:\n    shell: /bin/bash\n    onPermanentFailure:\n      report:\n        sentry:\n          ...\n\nCustom logging\n++++++++++++++\n\nIt's possible to provide a custom logging configuration, via the ``logging``\nconfiguration section.  For example, the following configuration displays log lines with\nan embedded timestamp for each message.\n\n.. code-block:: yaml\n\n    logging:\n      # In the format of:\n      # https://docs.python.org/3/library/logging.config.html#dictionary-schema-details\n      version: 1\n      disable_existing_loggers: false\n      formatters:\n        simple:\n          format: '%(asctime)s [%(processName)s/%(threadName)s] %(levelname)s (%(name)s): %(message)s'\n          datefmt: '%Y-%m-%d %H:%M:%S'\n      handlers:\n        console:\n          class: logging.StreamHandler\n          level: DEBUG\n          formatter: simple\n          stream: ext://sys.stdout\n      root:\n        level: INFO\n        handlers:\n          - console\n\nObscure configuration options\n+++++++++++++++++++++++++++++\n\nenabled: true|false (default true)\n##################################\n\n(new in yacron 0.18)\n\nIt is possible to disable a specific cron job by adding a `enabled: false` option.  Jobs\nwith `enabled: false` will simply be skipped, as if they aren't there, apart from\nvalidating the configuration.\n\n.. code-block:: yaml\n\n    jobs:\n      - name: test-01\n        enabled: false  # this cron job will not run until you change this to `true`\n        command: echo \"foobar\"\n        shell: /bin/bash\n        schedule: \"* * * * *\"\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgjcarneiro%2Fyacron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgjcarneiro%2Fyacron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgjcarneiro%2Fyacron/lists"}