0

I have python script which I need to run with diffrent frequency within a specified time frame. I tried to do this through crontab but I do not know how to bite it :/

My time intervals and frequencies look like this (i have it more than 200):
from 2015-11-15 06:00:00 to 2015-11-15 07:00:00 every 5 min
from 2015-11-14 06:20:00 to 2015-11-14 06:32:00 every 1 min
from 2015-11-14 18:00:00 to 2015-11-14 19:10:00 every 5 min
from 2015-11-14 11:00:00 to 2015-11-15 11:00:00 every 10 min

How can I do this in most efficient way? I work VPS Linux with CentOS 6 64bit This interval and frequency i have stored in MySQL

MastaBot
  • 273
  • 2
  • 4
  • 16
  • I think your question would be better received at serverfault.com – l'L'l Nov 10 '15 at 00:09
  • I don't know that page, thanks – MastaBot Nov 10 '15 at 00:15
  • how about just 1 script, not 200. No cron. And it is embedded in `Create Event`, firing off every minute. Easier to maintain. Inside determine what to do (which chunks to run). When finished, drop the event or turn off the event scheduler. Or set a sentinel in a table saying all done. See my silly write-up [here](http://stackoverflow.com/a/32508935). Or have a 1 minute event, a 5 minute event, a 10 minute event. Same concept – Drew Nov 10 '15 at 00:25
  • The fact that different things (chunks) do or don't execute in a 5 minute event could be controlled (jumped over) – Drew Nov 10 '15 at 00:30
  • @Drew I can't run python script through MySQL? I don't get it. Script is only one (python script) but i have around 200 intervals in every month when I need to run it with diffrent frequency. – MastaBot Nov 10 '15 at 00:38
  • comes down to are they operating system calls (then cron is your man). Are they only mysql commands, create event is. Not that mysql can't spawn to a python or php or executable, but I wouldnt – Drew Nov 10 '15 at 00:44
  • if you can write if statements, you can deal with it in create event. Bash script people wouldn't exactly do it my way. It's a preference thing. – Drew Nov 10 '15 at 00:45

0 Answers0