Created
January 17, 2018 17:35
-
-
Save nwjlyons/d69054118b7c8ea46dadf362e572f9de to your computer and use it in GitHub Desktop.
Convert a cron file into human readable format.
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
# 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