{ "info": { "author": "Eric Pruitt", "author_email": "eric.pruitt@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: POSIX", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.4", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "CronExpression\n==============\n\nThis module provides an easy to use interface for cron-like task\nscheduling. The cron expression evaluation implemented by this library\nis 100% Vixie Cron compatible and also supports `Java\nQuartz's `__\nnon-standard \"L\", \"W\" and \"#\" characters.\n\nOne other useful feature this library provides is the ability to set\ntriggers at arbitrary intervals such as every 9 hours, every 11 minutes,\netc., without the issues caused by using asterisk-slash notation; using\n``*/9`` in the hours field of most cron implementations would result in\na trigger firing at 9:XX AM at 6:XX PM each day, but with\nCronExpresssions, the trigger would fire at 9:XX AM, 6:XX PM then, on\nthe following day 3:XX AM, 12:XX PM, 9:XX PM and so.\n\nExamples\n--------\n\nStandard Cron Fields\n~~~~~~~~~~~~~~~~~~~~\n\nThis example shows basic instantiation of a CronExpression and how to\ncheck to see if a trigger should fire at a given time. The time tuples\nconsist of the year, month, date, hour and minute in that order.\n\n::\n\n >>> job = CronExpression(\"0 0 * * 1-5/2 find /var/log -delete\")\n >>> job.check_trigger((2010, 11, 17, 0, 0))\n True\n >>> job.check_trigger((2012, 12, 21, 0 , 0))\n False\n\nPeriodic Trigger\n~~~~~~~~~~~~~~~~\n\nThis trigger is a reminder to feed the kitten every 9 hours starting\nfrom May 1st, 2010 at 7 AM, GMT -6:00.\n\n::\n\n >>> job = CronExpression(\"0 %9 * * * Feed kitten\", (2010, 5, 1, 7, 0, -6))\n >>> job.comment\n \"Feed kitten\"\n >>> job.check_trigger((2010, 5, 1, 7, 0), utc_offset=-6)\n True\n >>> job.check_trigger((2010, 5, 1, 16, 0), utc_offset=-6)\n True\n >>> job.check_trigger((2010, 5, 2, 1, 0), utc_offset=-6)\n True\n\nSimple cron scheduler in less than ten lines\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nWith CronExpressions, a very basic task scheduler can be created with\nonly a handful of lines.\n\n::\n\n import time\n import os\n import cronex\n\n while True:\n for line in open(\"crontab\"):\n job = cronex.CronExpression(line.strip())\n\n if job.check_trigger(time.gmtime(time.time())[:5]):\n os.system(\"(\" + job.comment + \") & disown\")\n\n time.sleep(60)\n\nExpression Syntax\n-----------------\n\nReaders that are already familiar with cron should skip down to the\nsection titled *Repeaters*. Aside from the repeaters, the only other\nnotable difference in this implementation of cron expression evaluation\nfrom Vixie Cron's is that ranges wrap around: 22-2 in the hours field is\nthe same as ``22,23,0,1,2``. Everything else is standard\n``man 5 crontab``.\n\nEach cron trigger is specified with a combination of five white-space\nseparated fields that dictate when the event should occur. In order the\nfields specify trigger times for minutes past the hour, hour of the day,\nday of the month, month, and day of the week.\n\n::\n\n .--------------- minute (0 - 59)\n | .------------ hour (0 - 23)\n | | .--------- day of month (1 - 31)\n | | | .------ month (1 - 12) or Jan, Feb ... Dec\n | | | | .---- day of week (0 - 6) or Sun(0 or 7), Mon(1) ... Sat(6)\n V V V V V\n * * * * * command to be executed / trigger comment\n\nThere are four ways of specifying valid values for each field, all of\nwhich can be combined with each other using commas. There are ranges,\nwild-cards, steps, and repeaters. Repeaters are a non-standard addition\nto cron expressions that allow specification of events with arbitrary\nperiods.\n\nIf the hour, minute, and month of a given time period are valid values\nas specified in the trigger and *either* the day of the month *or* the\nday of the week is a valid value, the trigger fires.\n\nRanges and Wild-cards\n~~~~~~~~~~~~~~~~~~~~~\n\nRanges specify a starting and ending time period. It includes all values\nfrom the starting value to and including the ending value.\n\nWild-cards, indicated with a \"\\*\", in a field represents all valid\nvalues. It is *almost* the same as specifying the range 0-59 in the\nminutes field, 0-23 in the hours, 1-31 in days, 1-12 in months and 0-6\nfor weekdays.\n\nThe following cron expression is triggered every day at noon from June\nthrough September:\n\n::\n\n 0 12 * 6-9 * * remind \"Walk the ducks\"\n\nIf the day of the week field is a wild card, but the day of the month is\nan explicit range, the day of the week will be ignored and the trigger\nwill only be activated on the specified days of the month. If the day of\nthe month is a wild card, the same principal applies.\n\nThis expression is triggered every week day at 4:00 PM: ``0 16 * * 1-5``\n\nThis one is triggered the first nine days of the month: ``0 16 1-9 * *``\n\nThis one is triggered every day for the first week, but only on\nSaturdays thereafter: ``0 16 1-7 * 6``\n\nSteps\n~~~~~\n\nSteps are specified with a \"/\" and number following a range or\nwild-card. When iterating through a range with a step, the specified\nnumber of values will be skipped each time. ``1-10/2`` is the functional\nequivalent to ``1,3,5,7,9``.\n\nThe following cron expression is triggered on the first day of every\nquarter (Jan., Apr., ... Oct.) at midnight:\n\n::\n\n 0 0 1 */2 * * delete log.txt\n\nRepeaters\n~~~~~~~~~\n\nRepeaters cause an event to trigger after arbitrary periods of time from\na given moment which will be hitherto referred to as the epoch. By\ndefault, the epoch is January 1st, 1970 at 0:00. Triggers in different\nfields operate independently of each other: ``%10 %10 * * *`` would\ntrigger at 00:00, 00:10, ... 00:50, 10:00, 10:10, etc...\n\nThe following cron expression is triggered at noon on the 10th every 5\nmonths:\n\n::\n\n 0 12 10 %5 * Something amazing happens at noon...\n\nSpecial Symbols\n~~~~~~~~~~~~~~~\n\nThere are three additional special symbols: \"L\", \"W\" and \"#\".\n\nWhen used in the day of the month field, a number followed by \"L\"\nrepresents the occurrence of a day of the week represented by the value\npreceding \"L\". In the day of the month field, \"L\" without a prefixed\ninteger represents the last day of the month. ``0 0 * * 5L`` represent a\nmidnight trigger for the last Friday of each month whereas ``0 0 L 2 *``\nrepresents a midnight trigger for the last day of every February.\n\n\"W\" is only valid for the field representing days of the month, and must\nbe prefixed with an integer. It specifies the weekday (Monday-Friday)\nnearest the given day. In the construct ``0 0 7W * *``, when the 7th\nfalls on a Saturday, the trigger will be active on the 6th. If the 7th\nfalls on a Sunday, the trigger will be active on the 8th.\n\n\"#\" is only valid for the field representing days of the week. The \"#\"\nhas a prefix and suffix that represent the day of the week and the Nth\noccurrence of that day of the week. ``0 0 * * 0#5`` would trigger every\n5th Sunday.\n\nMiscellaneous\n~~~~~~~~~~~~~\n\nAll of the constructs above can be combined in individual fields using\ncommas: ``0,30 */7,5 1,%90,L 9-4/6,5-8 4#2`` is a completely valid,\nalbeit it hideous, expression.\n\nIn addition to the atoms above, there are several special strings that\ncan substitute common cron expressions. These strings *replace*, not\naugment the cron fields.\n\n::\n\n String Equivalent\n ------ ----------\n @yearly 0 0 1 1 *\n @annually 0 0 1 1 *\n @monthly 0 0 1 * *\n @weekly 0 0 * * 0\n @daily 0 0 * * *\n @midnight 0 0 * * *\n @hourly 0 * * * *\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ericpruitt/cronex", "keywords": "cron", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "cronex", "package_url": "https://pypi.org/project/cronex/", "platform": "", "project_url": "https://pypi.org/project/cronex/", "project_urls": { "Homepage": "https://github.com/ericpruitt/cronex" }, "release_url": "https://pypi.org/project/cronex/0.1.3.1/", "requires_dist": null, "requires_python": "", "summary": "This module provides an easy to use interface for cron-like task scheduling.", "version": "0.1.3.1" }, "last_serial": 4450972, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "caf358009e7011e94461a71ac8b88c4c", "sha256": "c2cce08fef851c0936840b79d0d731d51316b62efb139e5598bc7a28d58eeffc" }, "downloads": -1, "filename": "cronex-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "caf358009e7011e94461a71ac8b88c4c", "packagetype": "bdist_wheel", "python_version": "3.4", "requires_python": null, "size": 10232, "upload_time": "2016-12-22T03:08:02", "url": "https://files.pythonhosted.org/packages/34/f1/0f9400a0c65cdf7e616d9f119068c22b36f1bc9fec70a7ed53b551894a89/cronex-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a64469a5c018c1fc952877b665e2e199", "sha256": "d5cb44360faeb13a5ab254071f260ceb69c34b7c4623cab0f1333fd271a162d2" }, "downloads": -1, "filename": "cronex-0.1.0.tar.gz", "has_sig": false, "md5_digest": "a64469a5c018c1fc952877b665e2e199", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11094, "upload_time": "2014-11-17T14:39:59", "url": "https://files.pythonhosted.org/packages/8c/19/7e93236c9ffdfb03984fec525cd863f43617b632bb4a96567cf95fee3d0b/cronex-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "e8811f87368be2c4423437c8a3177e37", "sha256": "bc1167eba4a846bc9189cf28beaa652759b55178d262c4058aec3d57c6f33ec6" }, "downloads": -1, "filename": "cronex-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e8811f87368be2c4423437c8a3177e37", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 16188, "upload_time": "2017-02-16T20:20:42", "url": "https://files.pythonhosted.org/packages/a0/81/db97ab187072ed8edb3b34b213fe6b60f459cd679b3612830ba1c831db77/cronex-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "05b04992ae2c5ebe477ff4c63d18b480", "sha256": "79d959cd6334594826438dbc5a68b3b873fb9c2fd01266a390428283756a0ce9" }, "downloads": -1, "filename": "cronex-0.1.1.tar.gz", "has_sig": false, "md5_digest": "05b04992ae2c5ebe477ff4c63d18b480", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9090, "upload_time": "2017-02-16T17:15:41", "url": "https://files.pythonhosted.org/packages/41/ad/cb42731f16b9e767bb209219b96e505819704b6111d8213d699bdd643808/cronex-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "b6a95a630ee09abacf098e8c369660d3", "sha256": "8ba01d3ae9c1c1b4434fca79d6dd0f190e3030143629ae41b761eeeb1e92305b" }, "downloads": -1, "filename": "cronex-0.1.2.tar.gz", "has_sig": false, "md5_digest": "b6a95a630ee09abacf098e8c369660d3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8850, "upload_time": "2017-09-10T03:26:52", "url": "https://files.pythonhosted.org/packages/1e/79/23435bbb2b05eec23168d0597d88d77d187fd58747c0e4c2ed3d476ecd28/cronex-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "1775d0d4227e6eee5ba9107687b078b1", "sha256": "41049ea76b5d54fef66b353780cfc48b80e75e5c614abe9643e9164f4718e8b7" }, "downloads": -1, "filename": "cronex-0.1.3.tar.gz", "has_sig": false, "md5_digest": "1775d0d4227e6eee5ba9107687b078b1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9101, "upload_time": "2018-10-29T17:27:44", "url": "https://files.pythonhosted.org/packages/88/47/08d7c7b315ac24c43e1180fb04c8e6a134ef59430bf40f6c4e3b9139bff5/cronex-0.1.3.tar.gz" } ], "0.1.3.1": [ { "comment_text": "", "digests": { "md5": "14cf623e372d7a41bc4ca805a7410cdb", "sha256": "95a01ccb50a6b606fa68d5379c87396bd49e350f9e7198ef93a421e8474bf4ca" }, "downloads": -1, "filename": "cronex-0.1.3.1.tar.gz", "has_sig": false, "md5_digest": "14cf623e372d7a41bc4ca805a7410cdb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12008, "upload_time": "2018-11-04T23:45:43", "url": "https://files.pythonhosted.org/packages/ed/e9/419305235dd2f2b2038b6746cb57d32b3a5ebc0ef9600bdfd46d6da87232/cronex-0.1.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "14cf623e372d7a41bc4ca805a7410cdb", "sha256": "95a01ccb50a6b606fa68d5379c87396bd49e350f9e7198ef93a421e8474bf4ca" }, "downloads": -1, "filename": "cronex-0.1.3.1.tar.gz", "has_sig": false, "md5_digest": "14cf623e372d7a41bc4ca805a7410cdb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12008, "upload_time": "2018-11-04T23:45:43", "url": "https://files.pythonhosted.org/packages/ed/e9/419305235dd2f2b2038b6746cb57d32b3a5ebc0ef9600bdfd46d6da87232/cronex-0.1.3.1.tar.gz" } ] }