{"id":15931220,"url":"https://github.com/voxpupuli/puppet-cron","last_synced_at":"2025-12-11T21:44:51.569Z","repository":{"id":34875347,"uuid":"38884715","full_name":"voxpupuli/puppet-cron","owner":"voxpupuli","description":"Puppet module to manage cron jobs via /etc/cron.d","archived":false,"fork":false,"pushed_at":"2024-09-21T02:39:02.000Z","size":377,"stargazers_count":14,"open_issues_count":14,"forks_count":40,"subscribers_count":47,"default_branch":"master","last_synced_at":"2024-10-29T14:22:34.393Z","etag":null,"topics":["bsd-puppet-module","centos-puppet-module","debian-puppet-module","freebsd-puppet-module","gentoo-puppet-module","hacktoberfest","linux-puppet-module","puppet","redhat-puppet-module","scientific-puppet-module","sles-puppet-module"],"latest_commit_sha":null,"homepage":"https://forge.puppet.com/puppet/cron","language":"Ruby","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/voxpupuli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","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},"funding":{"open_collective":"vox-pupuli","github":"voxpupuli"}},"created_at":"2015-07-10T14:32:20.000Z","updated_at":"2024-09-21T02:39:04.000Z","dependencies_parsed_at":"2023-12-19T08:41:39.173Z","dependency_job_id":"2bf527aa-6d4a-4cac-bf54-76cf7455a93b","html_url":"https://github.com/voxpupuli/puppet-cron","commit_stats":{"total_commits":287,"total_committers":48,"mean_commits":5.979166666666667,"dds":0.7491289198606272,"last_synced_commit":"2c73d0b723bf3c0e80a69b1c641d8b2d3e761f08"},"previous_names":["roman-mueller/rmueller-cron"],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-cron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-cron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-cron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-cron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voxpupuli","download_url":"https://codeload.github.com/voxpupuli/puppet-cron/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247386258,"owners_count":20930618,"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":["bsd-puppet-module","centos-puppet-module","debian-puppet-module","freebsd-puppet-module","gentoo-puppet-module","hacktoberfest","linux-puppet-module","puppet","redhat-puppet-module","scientific-puppet-module","sles-puppet-module"],"created_at":"2024-10-07T01:04:30.702Z","updated_at":"2025-12-11T21:44:46.506Z","avatar_url":"https://github.com/voxpupuli.png","language":"Ruby","funding_links":["https://opencollective.com/vox-pupuli","https://github.com/sponsors/voxpupuli"],"categories":[],"sub_categories":[],"readme":"# Puppet Cron Module\n\n[![License](https://img.shields.io/github/license/voxpupuli/puppet-cron.svg)](https://github.com/voxpupuli/puppet-cron/blob/master/LICENSE)\n[![Build Status](https://travis-ci.org/voxpupuli/puppet-cron.png?branch=master)](https://travis-ci.org/voxpupuli/puppet-cron)\n[![Puppet Forge](https://img.shields.io/puppetforge/v/puppet/cron.svg)](https://forge.puppetlabs.com/puppet/cron)\n[![Puppet Forge - downloads](https://img.shields.io/puppetforge/dt/puppet/cron.svg)](https://forge.puppetlabs.com/puppet/cron)\n[![Puppet Forge - scores](https://img.shields.io/puppetforge/f/puppet/cron.svg)](https://forge.puppetlabs.com/puppet/cron)\n\n## Notes\n\nThis module manages cronjobs by placing files in `/etc/cron.d`.\nrmueller-cron was a detached fork of [torrancew/puppet-cron](https://github.com/torrancew/puppet-cron)\nAfter v1.0.0, the module was migrated to Vox Pupuli where it is now maintained and released under the [puppet](https://forge.puppet.com/puppet) namespace.\n\nThe current version (starting with v1.0.0) of this module requires Puppet 4.9.1 or greater.\nIf you are using an older version of Puppet you can pin the version to v0.2.1 which was still compatible with much older Puppet versions.\nYou can browse the documentation of that version in the v0.2.x branch [here](https://github.com/voxpupuli/puppet-cron/tree/v0.2.x).\n\nThis module supports configuration of cronjobs via Hiera as well.\nFor that you need to declare the `cron` class.\n\nThis module defines the following types:\n\n  * `cron::job`           - basic job resource\n  * `cron::job::multiple` - basic job resource for multiple jobs per file\n  * `cron::hourly`        - wrapper for hourly jobs\n  * `cron::daily`         - wrapper for daily jobs\n  * `cron::weekly`        - wrapper for weekly jobs\n  * `cron::monthly`       - wrapper for monthly jobs\n\n## Installation\n\nAs usual use `puppet module install puppet-cron` to install it.\n\n## Usage\n\nThe title of the job (e.g. `cron::job { 'title':`) is completely arbitrary. However, there can only be one cron job by that name.\nThe file in `/etc/cron.d/` will be created with the `$title` as the file name.\nKeep that in mind when choosing the name to avoid overwriting existing system cronjobs and use characters that don't cause problems when used in filenames.\n\n### cron\n\nIf you want the class to automatically install the correct cron package you can declare the `cron` class. By default it will then install the right package.\nIf you want to use Hiera to configure your cronjobs, you must declare the `cron` class.\n\nYou can disable the management of the cron package by setting the `manage_package` parameter to `false`.\n\nYou can also specify a different cron package name via `package_name`.\nBy default we try to select the right one for your distribution.\nBut in some cases (e.g. Gentoo) you might want to overwrite it here.\n\nExamples:\n\n```puppet\n  include cron\n```\n\nor:\n\n```puppet\n  class { 'cron':\n    manage_package =\u003e false,\n  }\n```\n\nAdd custom crontab run-parts\n\n```puppet\nclass { 'cron':\n  manage_crontab    =\u003e true,\n  crontab_run_parts =\u003e {'5min' =\u003e { 'user' =\u003e 'root', 'minute' =\u003e '*/5' }},\n}\n```\n\n### cron::job\n\n`cron::job` creates generic jobs in `/etc/cron.d`.\nIt allows specifying the following parameters:\n\n  * `ensure`      - optional - defaults to \"present\"\n  * `command`     - required - the command to execute\n  * `minute`      - optional - defaults to \"\\*\"\n  * `hour`        - optional - defaults to \"\\*\"\n  * `date`        - optional - defaults to \"\\*\"\n  * `month`       - optional - defaults to \"\\*\"\n  * `weekday`     - optional - defaults to \"\\*\"\n  * `special`     - optional - defaults to undef\n  * `user`        - optional - defaults to \"root\"\n  * `environment` - optional - defaults to \"\"\n  * `mode`        - optional - defaults to \"0600\"\n  * `description` - optional - defaults to undef\n\nExample:\nThis would create the file `/etc/cron.d/mysqlbackup` and run the command `mysqldump -u root mydb` as root at 2:40 AM every day:\n\n```puppet\n  cron::job { 'mysqlbackup':\n    minute      =\u003e '40',\n    hour        =\u003e '2',\n    date        =\u003e '*',\n    month       =\u003e '*',\n    weekday     =\u003e '*',\n    user        =\u003e 'root',\n    command     =\u003e 'mysqldump -u root mydb',\n    environment =\u003e [ 'MAILTO=root', 'PATH=\"/usr/bin:/bin\"', ],\n    description =\u003e 'Mysql backup',\n  }\n```\n\nHiera example:\n\n```yaml\n---\ncron::job:\n  'mysqlbackup':\n    command: 'mysqldump -u root mydb'\n    minute: 0\n    hour: 0\n    date: '*'\n    month: '*'\n    weekday: '*'\n    user: root\n    environment:\n      - 'MAILTO=root'\n      - 'PATH=\"/usr/bin:/bin\"'\n    description: 'Mysql backup'\n```\n\n### cron::job::multiple\n\n`cron:job::multiple` creates a file in `/etc/cron.d` with multiple cron jobs configured in it.\nIt allows specifying the following parameters:\n\n  * `ensure`      - optional - defaults to \"present\"\n  * `jobs`        - required - an array of hashes of multiple cron jobs using a similar structure as `cron::job`-parameters\n  * `environment` - optional - defaults to \"\"\n  * `mode`        - optional - defaults to \"0600\"\n\nAnd the keys of the jobs hash are:\n\n  * `command`     - required - the command to execute\n  * `minute`      - optional - defaults to \"\\*\"\n  * `hour`        - optional - defaults to \"\\*\"\n  * `date`        - optional - defaults to \"\\*\"\n  * `month`       - optional - defaults to \"\\*\"\n  * `weekday`     - optional - defaults to \"\\*\"\n  * `special`     - optional - defaults to undef\n  * `user`        - optional - defaults to \"root\"\n  * `description` - optional - defaults to undef\n\nExample:\n\n```puppet\ncron::job::multiple { 'test_cron_job_multiple':\n  jobs =\u003e [\n    {\n      minute      =\u003e '55',\n      hour        =\u003e '5',\n      date        =\u003e '*',\n      month       =\u003e '*',\n      weekday     =\u003e '*',\n      user        =\u003e 'rmueller',\n      command     =\u003e '/usr/bin/uname',\n      description =\u003e 'print system information',\n    },\n    {\n      command     =\u003e '/usr/bin/sleep 1',\n      description =\u003e 'Sleeping',\n    },\n    {\n      command     =\u003e '/usr/bin/sleep 10',\n      special     =\u003e 'reboot',\n    },\n  ],\n  environment =\u003e [ 'PATH=\"/usr/sbin:/usr/bin:/sbin:/bin\"' ],\n}\n\n```\n\nHiera example:\n\n```yaml\n---\ncron::job::multiple:\n  'test_cron_job_multiple':\n    jobs:\n      - {\n          minute: 55,\n          hour: 5,\n          date: '*',\n          month: '*',\n          weekday: '*',\n          user: rmueller,\n          command: '/usr/bin/uname',\n          description: 'print system information',\n        }\n      - {\n          command: '/usr/bin/sleep 1',\n          description: 'Sleeping',\n        }\n      - {\n          command: '/usr/bin/sleep 10',\n          special: 'reboot',\n        }\n\n    environment:\n      - 'PATH=\"/usr/sbin:/usr/bin:/sbin:/bin\"'\n```\n\nThat will generate the file `/etc/cron.d/test_cron_job_multiple` with essentially this content:\n\n```\nPATH=\"/usr/sbin:/usr/bin:/sbin:/bin\"\n\n55 5 * * *  rmueller  /usr/bin/uname\n* * * * *  root  /usr/bin/sleep 1\n@reboot  root  /usr/bin/sleep 10\n```\n\n### cron::hourly\n\n`cron::hourly` creates jobs in `/etc/cron.d` that run once per hour.\nIt allows specifying the following parameters:\n\n  * `ensure`      - optional - defaults to \"present\"\n  * `command`     - required - the command to execute\n  * `minute`      - optional - defaults to \"0\"\n  * `user`        - optional - defaults to \"root\"\n  * `environment` - optional - defaults to \"\"\n  * `mode`        - optional - defaults to \"0600\"\n  * `description` - optional - defaults to undef\n\nExample:\nThis would create the file `/etc/cron.d/mysqlbackup_hourly` and run the command `mysqldump -u root mydb` as root on the 20th minute of every hour:\n\n```puppet\n  cron::hourly { 'mysqlbackup_hourly':\n    minute      =\u003e '20',\n    user        =\u003e 'root',\n    command     =\u003e 'mysqldump -u root mydb',\n    environment =\u003e [ 'MAILTO=root', 'PATH=\"/usr/bin:/bin\"', ],\n  }\n```\n\nHiera example:\n\n```yaml\n---\ncron::hourly:\n  'mysqlbackup_hourly':\n    minute: 20\n    user: root\n    command: 'mysqldump -u root mydb'\n    environment:\n      - 'MAILTO=root'\n      - 'PATH=\"/usr/bin:/bin\"'\n```\n\n### cron::daily\n\n`cron::daily` creates jobs in `/etc/cron.d` that run once per day.\nIt allows specifying the following parameters:\n\n  * `ensure`      - optional - defaults to \"present\"\n  * `command`     - required - the command to execute\n  * `minute`      - optional - defaults to \"0\"\n  * `hour`        - optional - defaults to \"0\"\n  * `user`        - optional - defaults to \"root\"\n  * `environment` - optional - defaults to \"\"\n  * `mode`        - optional - defaults to \"0600\"\n  * `description` - optional - defaults to undef\n\nExample:\nThis would create the file `/etc/cron.d/mysqlbackup_daily` and run the command `mysqldump -u root mydb` as root at 2:40 AM every day, like the above generic example:\n\n```puppet\n  cron::daily { 'mysqlbackup_daily':\n    minute  =\u003e '40',\n    hour    =\u003e '2',\n    user    =\u003e 'root',\n    command =\u003e 'mysqldump -u root mydb',\n  }\n```\n\nHiera example:\n\n```yaml\n---\ncron::daily:\n  'mysqlbackup_daily':\n    minute: 40\n    hour: 2\n    user: root\n    command: 'mysqldump -u root mydb'\n```\n\n\n### cron::weekly\n\n`cron::weekly` creates jobs in `/etc/cron.d` that run once per week.\nIt allows specifying the following parameters:\n\n  * `ensure`      - optional - defaults to \"present\"\n  * `command`     - required - the command to execute\n  * `minute`      - optional - defaults to \"0\"\n  * `hour`        - optional - defaults to \"0\"\n  * `weekday`     - optional - defaults to \"0\"\n  * `user`        - optional - defaults to \"root\"\n  * `environment` - optional - defaults to \"\"\n  * `mode`        - optional - defaults to \"0600\"\n  * `description` - optional - defaults to undef\n\nExample:\nThis would create the file `/etc/cron.d/mysqlbackup_weekly` and run the command `mysqldump -u root mydb` as root at 4:40 AM every Sunday, like the above generic example:\n\n```puppet\n  cron::weekly { 'mysqlbackup_weekly':\n    minute  =\u003e '40',\n    hour    =\u003e '4',\n    weekday =\u003e '0',\n    user    =\u003e 'root',\n    command =\u003e 'mysqldump -u root mydb',\n  }\n```\n\nHiera example:\n\n```yaml\n---\ncron::weekly:\n  'mysqlbackup_weekly':\n    minute: 40\n    hour: 4\n    weekday: 0\n    user: root\n    command: 'mysqldump -u root mydb'\n```\n\n\n### cron::monthly\n\n`cron::monthly` creates jobs in `/etc/cron.d` that run once per month.\nIt allows specifying the following parameters:\n\n  * `ensure`      - optional - defaults to \"present\"\n  * `command`     - required - the command to execute\n  * `minute`      - optional - defaults to \"0\"\n  * `hour`        - optional - defaults to \"0\"\n  * `date`        - optional - defaults to \"1\"\n  * `user`        - optional - defaults to \"root\"\n  * `environment` - optional - defaults to \"\"\n  * `mode`        - optional - defaults to \"0600\"\n  * `description` - optional - defaults to undef\n\nExample:\nThis would create the file `/etc/cron.d/mysqlbackup_monthly` and run the command `mysqldump -u root mydb` as root at 3:40 AM the 1st of every month, like the above generic example:\n\n```puppet\n  cron::monthly { 'mysqlbackup_monthly':\n    minute  =\u003e '40',\n    hour    =\u003e '3',\n    date    =\u003e '1',\n    user    =\u003e 'root',\n    command =\u003e 'mysqldump -u root mydb',\n  }\n```\n\nHiera example:\n\n```yaml\n---\ncron::monthly:\n  'mysqlbackup_monthly':\n    minute: 40\n    hour: 3\n    date: 1\n    user: root\n    command: 'mysqldump -u root mydb'\n```\n\n\n## Contributors\n\n  * Kevin Goess (@kgoess)               - Environment variable support + fixes\n  * Andy Shinn (@andyshinn)             - RedHat derivatives package name fix\n  * Chris Weyl (@RsrchBoy)              - Fixed Puppet 3.2 deprecation warnings\n  * Mathew Archibald (@mattyindustries) - Fixed file ownership issues\n  * The Community                       - Continued improvement of this module via bugs and patches\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpupuli%2Fpuppet-cron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoxpupuli%2Fpuppet-cron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpupuli%2Fpuppet-cron/lists"}