Cron Methodology and Script Start/End Times #1378
-
I am confused about the default Cron script start times and default script schedule times. Here is a simplified look at cron: Here is a look at the schedule start / stop times. run_capital_update makes sense (boot the script 15 minutes before scheduled execution) run_daily_fx... and run_daily_price... have the same cron start time, but the actual run times are quite different
run_daily_update_multiple_adjusted_prices starts in cron at 23:00, at the exact time of its scheduled run - this appears to make sense! run_systems is started by cron at 20:30, but the script is scheduled to start at 20:05 and end at 23:50. Is this assuming the script will run in less than 25 minutes and finish, so we're restarting it? run_strategy_order_generator is scheduled by cron to start at 20:45, but the scheduled start is 20:10. Is this again a case of just rebooting the script after an assumed script-finish? That's probably more than I needed to write, just trying to figure out the basic methodology. I'm sort of wondering if it would make more sense to just start all crons at midnight as simpler, and everything is finished executing at that point - so ready for the next day. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I tend to think of it like this: Start time in config: what is the earliest possible time I would want this to run, keeping in mind that I might need to run it manually if there is an issue and I don't want to have to fiddle with the config to do that End time in config: what is the latest possible time I would want this to stop; same consideration as above, but also taking into account processes that run in a loop and will use this as the actual stop time Crontab: when do I actually want this to run? With all that in mind, you should consider the provided start/stop defaults as an example, and adjust them to suit your own needs. |
Beta Was this translation helpful? Give feedback.
-
To address your specific questions:
For these scripts (given the config), the configured start and end times are not expected to be a limiting factor. The scripts will be started by cron, possibly wait for any previous processes to complete, run to completion, and then exit well before the configured end time. There is no "rebooting" - each process is intended to run once per day.
This script will run in a loop all day long, waiting until 20:00 to actually do anything. Not how I would configure it, but probably harmless. That used to consume a lot of CPU cycles just checking if it's time to run, but I think that issue has been addressed. EDIT: to add some additional context here, I believe Rob now downloads prices throughout the day. He probably updated the crontab file to reflect that, but the start time in the config no longer reflects what he's actually using. |
Beta Was this translation helpful? Give feedback.
To address your specific questions:
For these scripts (given the config), the configured s…