Skip to content

Instantly share code, notes, and snippets.



Last active Aug 29, 2015
What would you like to do?
Sample script for using plan to write cron files
#!/usr/bin/env python3
from plan import Plan
import argparse
cron = Plan()
# write the cron jobs here:
cron.command("/usr/bin/pganalyze-collector --cron", every="5.minute")
cron.command("/bin/date >> /home/unionx/time.txt", every="1.minute")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="show the cron or write it")
parser.add_argument("--check", help="show the cron output", action="store_true")
parser.add_argument("--update", help="update the cron file", action="store_true")
parser.add_argument("--write", help="write a new cron file", action="store_true")
args = parser.parse_args()
if args.check:
elif args.update:"update")
elif args.write:"write")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment