Skip to content

Instantly share code, notes, and snippets.

@nwjlyons
Created January 17, 2018 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nwjlyons/d69054118b7c8ea46dadf362e572f9de to your computer and use it in GitHub Desktop.
Save nwjlyons/d69054118b7c8ea46dadf362e572f9de to your computer and use it in GitHub Desktop.
Convert a cron file into human readable format.
# Prerequisites
#
# - npm install -g hcron
import subprocess
cron_input = open('cron.input.txt')
cron_output = open('cron.output.txt', 'w')
for line in cron_input.readlines():
response = subprocess.run(["hcron", line.strip()], stdout=subprocess.PIPE)
if response.stdout:
cron_output.write(response.stdout.decode().replace("the process ", "\n").replace(" will run", ""))
cron_output.write("\n")
cron_input.close()
cron_output.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment