Skip to main content

An easy to start crontab

Project description

pycronjob

An easy start crontab tools
Supports 5~7 cron symbols
0/1 * * * * or 0 */2 * * * ? or 0 */3 * * * ? *

How to Use

install

pip install pycronjob

base

from pycronjob import Crontab

def p(*args):
    print(args, datetime.datetime.now())
    print('====\n')

joblist = [
    {'crontab': '0/1 * * * *', 'func': p, 'args': ('job1',)},
    {'crontab': '0 */2 * * * ?', 'func': p, 'args': ('job2',)},
    {'crontab': '0 */3 * * * ? *', 'func': p, 'args': ('job3',)},
]

sync

crontab = Crontab(joblist)
crontab.start()

async

crontab = Crontab(joblist, True)
crontab.start()
# do other thing

sync to async

import threading
def inner():
    crontab = Crontab(job_list)
    while True:
        try:
            crontab.start()
        except:
            logger.info(traceback.format_exc())
timer = threading.Timer(1, inner)
timer.daemon = True
timer.start()

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

pycronjob-1.2.2-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file pycronjob-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: pycronjob-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.12.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.11

File hashes

Hashes for pycronjob-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 13ac7bee1fda3a77601c7dfbf0165c19c45436595c321b8e74a6b2fe9b5ac472
MD5 e5152f583c04a72614a07139c309a3e9
BLAKE2b-256 a7635dc59d240f53307c04c7cb0272aa584ed59bd61d790bf7cab1ce5ceb0789

See more details on using hashes here.

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