|
| 1 | +about_resource: crontab-1.0.4.tar.gz |
| 2 | +name: crontab |
| 3 | +version: 1.0.4 |
| 4 | +download_url: https://files.pythonhosted.org/packages/1e/8b/3ea72ac8e26090b63779b4e0074af79b02bbbab7ddd01b36109bc0892d31/crontab-1.0.4.tar.gz |
| 5 | +description: | |
| 6 | + Parse and use crontab schedules in Python |
| 7 | + Copyright 2011-2021 Josiah Carlson |
| 8 | + |
| 9 | + Released under the LGPL license version 2.1 and version 3 (you can choose |
| 10 | + which you'd like to be bound under). |
| 11 | + |
| 12 | + Description |
| 13 | + =========== |
| 14 | + |
| 15 | + This package intends to offer a method of parsing crontab schedule entries and |
| 16 | + determining when an item should next be run. More specifically, it calculates |
| 17 | + a delay in seconds from when the .next() method is called to when the item |
| 18 | + should next be executed. |
| 19 | + |
| 20 | + Comparing the below chart to http://en.wikipedia.org/wiki/Cron#CRON_expression |
| 21 | + you will note that W and # symbols are not supported. |
| 22 | + |
| 23 | + ============= =========== ================= ============== =========================== |
| 24 | + Field Name Mandatory Allowed Values Default Value Allowed Special Characters |
| 25 | + ============= =========== ================= ============== =========================== |
| 26 | + Seconds No 0-59 0 \* / , - |
| 27 | + Minutes Yes 0-59 N/A \* / , - |
| 28 | + Hours Yes 0-23 N/A \* / , - |
| 29 | + Day of month Yes 1-31 N/A \* / , - ? L |
| 30 | + Month Yes 1-12 or JAN-DEC N/A \* / , - |
| 31 | + Day of week Yes 0-6 or SUN-SAT N/A \* / , - ? L |
| 32 | + Year No 1970-2099 * \* / , - |
| 33 | + ============= =========== ================= ============== =========================== |
| 34 | + |
| 35 | + If your cron entry has 5 values, minutes-day of week are used, default seconds |
| 36 | + is and default year is appended. If your cron entry has 6 values, minutes-year |
| 37 | + are used, and default seconds are prepended. |
| 38 | + |
| 39 | + As such, only 5-7 value crontab entries are accepted (and mangled to 7 values, |
| 40 | + as necessary). |
| 41 | + |
| 42 | + |
| 43 | + Sample individual crontab fields |
| 44 | + ================================ |
| 45 | + |
| 46 | + Examples of supported entries are as follows:: |
| 47 | + |
| 48 | + * |
| 49 | + */5 |
| 50 | + 7/8 |
| 51 | + 3-25/7 |
| 52 | + 3,7,9 |
| 53 | + 0-10,30-40/5 |
| 54 | + |
| 55 | + For month or day of week entries, 3 letter abbreviations of the month or day |
| 56 | + can be used to the left of any optional / where a number could be used. |
| 57 | + |
| 58 | + For days of the week:: |
| 59 | + |
| 60 | + mon-fri |
| 61 | + sun-thu/2 |
| 62 | + |
| 63 | + For month:: |
| 64 | + |
| 65 | + apr-jul |
| 66 | + mar-sep/3 |
| 67 | + |
| 68 | + Installation |
| 69 | + ============ |
| 70 | + |
| 71 | + :: |
| 72 | + |
| 73 | + pip install crontab |
| 74 | + |
| 75 | + |
| 76 | + Example uses |
| 77 | + ============ |
| 78 | + |
| 79 | + :: |
| 80 | + |
| 81 | + >>> from crontab import CronTab |
| 82 | + >>> from datetime import datetime |
| 83 | + >>> # define the crontab for 25 minutes past the hour every hour |
| 84 | + ... entry = CronTab('25 * * * *') |
| 85 | + >>> # find the delay from when this was run (around 11:13AM) |
| 86 | + ... entry.next() |
| 87 | + 720.81637899999998 |
| 88 | + >>> # find the delay from when it was last scheduled |
| 89 | + ... entry.next(datetime(2011, 7, 17, 11, 25)) |
| 90 | + 3600.0 |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + Notes |
| 96 | + ===== |
| 97 | + |
| 98 | + At most one of 'day of week' or 'day of month' can be a value other than '?' |
| 99 | + or '*'. We violate spec here and allow '*' to be an alias for '?', in the case |
| 100 | + where one of those values is specified (seeing as some platforms don't support |
| 101 | + '?'). |
| 102 | + |
| 103 | + This module also supports the convenient aliases:: |
| 104 | + |
| 105 | + @yearly |
| 106 | + @annually |
| 107 | + @monthly |
| 108 | + @weekly |
| 109 | + @daily |
| 110 | + @hourly |
| 111 | + |
| 112 | + Example full crontab entries and their meanings:: |
| 113 | + |
| 114 | + 30 */2 * * * -> 30 minutes past the hour every 2 hours |
| 115 | + 15,45 23 * * * -> 11:15PM and 11:45PM every day |
| 116 | + 0 1 ? * SUN -> 1AM every Sunday |
| 117 | + 0 1 * * SUN -> 1AM every Sunday (same as above) |
| 118 | + 0 0 1 jan/2 * 2011-2013 -> |
| 119 | + midnight on January 1, 2011 and the first of every odd month until |
| 120 | + the end of 2013 |
| 121 | + 24 7 L * * -> 7:24 AM on the last day of every month |
| 122 | + 24 7 * * L5 -> 7:24 AM on the last friday of every month |
| 123 | + 24 7 * * Lwed-fri -> |
| 124 | + 7:24 AM on the last wednesday, thursday, and friday of every month |
| 125 | +homepage_url: https://github.com/josiahcarlson/parse-crontab |
| 126 | +package_url: pkg:pypi/ [email protected] |
| 127 | +license_expression: lgpl-2.1 AND (lgpl-2.0-plus AND lgpl-2.0 AND lgpl-3.0) |
| 128 | +copyright: Copyright Josiah Carlson |
| 129 | +redistribute: yes |
| 130 | +attribute: yes |
| 131 | +track_changes: yes |
| 132 | +checksum_md5: ad190b69ff4199c44a5170daf896e73f |
| 133 | +checksum_sha1: 5a7e52b3f0e84519966b370b871c0ca1d3f9c20a |
| 134 | +licenses: |
| 135 | + - key: lgpl-2.1 |
| 136 | + name: GNU Lesser General Public License 2.1 |
| 137 | + file: lgpl-2.1.LICENSE |
| 138 | + - key: lgpl-3.0 |
| 139 | + name: GNU Lesser General Public License 3.0 |
| 140 | + file: lgpl-3.0.LICENSE |
| 141 | + - key: lgpl-2.0 |
| 142 | + name: GNU Library General Public License 2.0 |
| 143 | + file: lgpl-2.0.LICENSE |
| 144 | + - key: lgpl-2.0-plus |
| 145 | + name: GNU Library General Public License 2.0 or later |
| 146 | + file: lgpl-2.0-plus.LICENSE |
0 commit comments