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.3.0.tar.gz (8.1 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.3.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for crondir-0.3.0.tar.gz
Algorithm Hash digest
SHA256 66c9f8a3ff5e5f8ece3e219e0d0f252e0bbff94788b36f4031ac08f6df3b2026
MD5 c35a6dd330ebdcac190e585b0c66682a
BLAKE2b-256 9ea2acd0e8178371b0cd81f259896760333bd6c3da537bb5928380eb5dd5a20c

See more details on using hashes here.

Provenance

The following attestation bundles were made for crondir-0.3.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: crondir-0.3.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.13.7

File hashes

Hashes for crondir-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 21ce1849b554f0453d25eea8d1061ae4184cc5dae6dfb76917043f41148d40a2
MD5 e98f618418c1454a2c74d73052a3f7f1
BLAKE2b-256 d5f1752722e2244e6fbb6c225db3aaa9a94262faf99c0b23ec7c1d93717bd77a

See more details on using hashes here.

Provenance

The following attestation bundles were made for crondir-0.3.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