Shell – Display cron job times in a human-friendly format

cronpythonshell-script

Is there a way to display or is there a tool that can parse a crontab expression and display it in a human-friendly way?

10 6 * * * sh /usr/local/crons/file_check.sh

For example, for the above cron I want the time on the above cronjob to be displayed as

06:10 hrs

or in any other human-friendly way.

Currently, I have decided to go with writing a shell script or python to manipulate the output of crontab -l to display it in a way a non-technical person can understand when the job will be run next, but if there is a direct method, it would be great.

P.S:- A bash or python solution is preferred.

Best Answer

As you want a Python solution:

https://pypi.python.org/pypi/pretty-cron/1.0.0

I have not tried it. It's just one of the first things that pop up when you search for cron in pypi.

Related Question