Library
Library for working with multiple cron jobs within a single cron table.
- cronberry.Command
Type alias for the cron job command.
- class cronberry.CronJob(title: str, timing: ShorthandSyntax | ExplicitTiming, command: str, *, mailto: str = 'docs', mailfrom: str = 'root', path: str = '/home/docs', shell: str = '/bin/sh', cron_tz: str = 'Etc/UTC')
Cron job representation, along with associated environment variables.
- classmethod from_job(job_text: str, title: str, envvars: dict[str, str]) CronJob
Create a CronJob from a cron job in texual format with a provided title.
- static parse_cron_text(cron_text: str) tuple[ShorthandSyntax | ExplicitTiming, str]
Parse a cron job in textual format.
- to_file_text() str
Get the cron job as it would be written in the crontab.
- to_job() tuple[str, str, dict[str, str]]
Get the job syntax, with the accompanying title.
- cronberry.Timing: TypeAlias = cronberry.fields.ShorthandSyntax | cronberry.fields.ExplicitTiming
Type alias for any kind of timing specification.
- cronberry.add_cronjobs(jobs: Iterable[CronJob], filepath: str | None = None, *, overwrite: bool = False) None
Add the cron jobs to a crontab.
- cronberry.clear_cronjobs(filepath: str | None = None)
Clear all of the cronjobs in a crontab.
- cronberry.remove_cronjob(job_name: str, filepath: str | None = None, *, ignore_missing: bool = False) None
Remove the cronjobs from a crontab.
- cronberry.save_crontab(dest_filepath: str) None
Save the current user’s crontab to a file.