Skip to main content

A user-space cron.d directory

Project description

crondir

PyPI Documentation Tests Coverage

Manage your user crontab with snippets in a cron.d directory in your home.

Simplifies the automated management of cron tasks in the user space. Snippets are concatenated from your cron.d into the crontab.

  • Store and manage crontab snippets in separate files
  • Does not interfere with existing crontab entries
  • Backs up crontab each time it builds
  • Everything configurable

Usage

A crontab snippet is a file containing lines to go in a crontab.

To install:

pip install crondir

Add a cron snippet:

crondir add path/to/snippet_name

Remove a cron snippet:

crondir remove snippet_name

List installed cron snippets:

crondir list

Build the crontab from current definitions:

crondir build

Or you may find it easier to skip the install step and run it using uv.

uvx crondir add path/to/snippet_name
uvx crondir remove path/to/snippet_name
uvx crondir list
uvx crondir build

By default, crondir stores crontab snippets in ~/.cron.d/, and creates backups in ~/.cron.d/backups/.

For full command line options, see command documentation

Example

Lets say we're deploying a project with hourly and daily cron tasks, and will be running it from a deploy user. Our project is at /home/deploy/project/

Create a snippet file in our project, cron_tasks, containing the lines to add to the crontab:

0 * * * * /home/deploy/project/bin/hourly_refresh.sh
1 0 * * * /home/deploy/project/bin/daily_refresh.sh

To add this snippet, run:

cd ~
uvx crondir add project/cron_task project_tasks
uvx crondir build

This will:

  • create the dir ~/.cron.d/
  • copy project/cron_task into ~/.cron.d/ as ~/.cron.d/project_tasks
  • rebuild the crontab to include the lines from ~/.cron.d/project_tasks

If we want to remove the snippet, we can run:

cd ~
uvx crondir remove project_tasks
uvx crondir build

This will

  • remove the file ~/.cron.d/project_tasks
  • concatenate all the files in ~/.cron.d
  • add them to the crontab under any existing unmanaged entries

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crondir-0.2.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crondir-0.2.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file crondir-0.2.0.tar.gz.

File metadata

  • Download URL: crondir-0.2.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for crondir-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ed69564273ab4855d4370e161531f1bef0bde302928759d27beb76d29795652b
MD5 22f1263aaa634fa30c52217f0a192b3c
BLAKE2b-256 6f94bfb48806baee4f3f061362d13917443b16408aeca02876ec61213f53071f

See more details on using hashes here.

Provenance

The following attestation bundles were made for crondir-0.2.0.tar.gz:

Publisher: pypi.yml on radiac/crondir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file crondir-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: crondir-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for crondir-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3fea11419290dd4d77e3028f8d2cecfb1e51d7edb06fe97e33a2ec3761873829
MD5 9d62ce615a74fad54cb1d7d9499ebee8
BLAKE2b-256 2c5a9e5cdcbf8360dcb011501a04023e3977044a393702d47c55ad1b290a22f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for crondir-0.2.0-py3-none-any.whl:

Publisher: pypi.yml on radiac/crondir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page