Created
June 18, 2021 13:26
-
-
Save CodyKochmann/74b35b67b528eae278dee9673158b745 to your computer and use it in GitHub Desktop.
functions to generate random cron schedules for different common intervals in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Author: Cody Kochmann | |
# Created: 2021-06-18 | |
# License: MIT | |
from random import randint | |
class cron(): | |
@property | |
def hourly(self): | |
return f'{randint(0, 59)} * * * *' | |
@property | |
def daily(self): | |
return f'{randint(0, 59)} {randint(0, 23)} * * *' | |
@property | |
def weekly(self): | |
return f'{randint(0, 59)} {randint(0, 23)} * * {randint(0, 6)}' | |
@property | |
def monthly(self): | |
return f'{randint(0, 59)} {randint(0, 23)} {randint(0, 27)} * *' | |
@property | |
def yearly(self): | |
return f'{randint(0, 59)} {randint(0, 23)} {randint(0, 27)} {randint(0, 11)} *' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment