Best practices for writing jobs run through cron

webuser1200 at gmail.com webuser1200 at gmail.com
Mon Jul 6 20:36:50 CEST 2015


I needed help/advice with a few things:

1. Is there a good example of a well written command line task that gets run routinely from the shell. Job would handle logging and be able to redirect stdout to a stdout file and stderr to a stderr file. 

2. I was going to setup a dict with all jobs and a unique identifier for each job. Then I would use the filesystem to capture output form each job. Jobs output would be redirected to <job_key>_yyyymmddhhmmss_start.stdout and <job_key>_yyyymmddhhmmss_end.stderr

3. Each script would know it's job id and would load the setup dict at start time and see if it still needs to be run or not. If not and it is still trying to run, and error would be sent. 

4. A web interface would look at the file system and generate a list of job runs and show errors etc.

5. A task would run end of the week which archive old runs of jobs by moving directories over to an archive folder. 

I'd like to lean towards simplicity...

Are there other examples that I should be looking at? Any thoughts on the above setup?

Regards,

WU


More information about the Python-list mailing list