The a = "..." part was to allow me to give you a runnable example, you will have to figure out how to read the crontabs yourself. I dont know how your system is set up. Also Ammar Ali's suggestion is a considerable improvement on my code, you should go with that.