March 3, 201313 yr I want to make the cron.daily jobs run at 00:00 in stead of the default 4:40, because i am starting a script at that time that fetches subtitles for tv shows, like a backlog system. If i run it at 4:40, it has to spin up drives etc, while at 00:00 chances are that the drives are still up and running. Now i know how to edit the cron file by hand to change the time, but i would like to do this on boot/startup, automatically, using a (python) script or even a cmd line from within to go script. Anyone has an idea on how to do this?
March 3, 201313 yr Python is (I assume, never learnt it myself) pretty easy to learn. You'd want to combine something like this:- http://snipplr.com/view/6630/ With regex, so, it'd go down the file (No idea where it's located, so, I can't give you the exact regex to modify it) and modify only the line you want.
March 3, 201313 yr Author I'm no stanger to programming, and i'm pretty familiar with python, but i was hoping there would be a "nicer" way of changing it besides just open the file and read/write it but hey why not. Its even easier to just make an adapted copy, and copy that over the current cron table on startup... but it's not very sophisticated *edit* found a nice module, gonna check it out: https://pypi.python.org/pypi/python-crontab/
March 3, 201313 yr I'm no stanger to programming, and i'm pretty familiar with python, but i was hoping there would be a "nicer" way of changing it besides just open the file and read/write it but hey why not. Its even easier to just make an adapted copy, and copy that over the current cron table on startup... but it's not very sophisticated *edit* found a nice module, gonna check it out: https://pypi.python.org/pypi/python-crontab/ If the file never changes, can't you just do (In your go script):- cp /lo/ca/ti/on/backUpOfCronTab /newLocation/crontab ?
March 3, 201313 yr Author Yeah, just copy an allready adapted one, like i said before. But i've got the python module running, it does a nice job as well, could come in handy in the future.
Archived
This topic is now archived and is closed to further replies.