One of the main goals of job-scheduler was to make it to adopt to any scheduling problems while keeping it simple and generic. When I was diciding about input file format it was a great concern to make all the functionalities available, while keeping it simple. And now I admit that this input file format is not an ideal, but achieves some of my goals. (I'll be glad to receive your suggestions about input file format <job-scheduler-devel@lists.sourceforge.net>);
Before we begin note that blank lines and lines starting with a '#' sign in the input file are ignored, so we can use the latter for commenting.
For scheduling a program, scheduler needs some information. To simplify things call the information needed for scheduling a program a record. Here's how we can specify a record:
#sample record > (cycle) (interval) (process_type) (program and arguments) [list of times] ... #end of sample record
The first important thing in a record is that it starts with a line that that contains nothing but a '>' sign at its beginning this indicates the start of a record.
now we describe each record entry:
If cycle is zero you should specify the list of the times in which the program should be run by putting one run time per line. You can override the interval entry by specifying two times in a single line (the first is assumed to be the start of a run interval and the next its end). The list of the times should be sorted increasingly.
Note that time is in the format Y-m-d H:M:S with no new line in the middle. For example "2004-09-24 18:09:43" is a valid time.
Sample Input File :-----------------------* Sample Input File *------------------------- # consider the date is '2008-07-21 08:45:21' # start of a record > # run the program log_system_state every 36000 seconds(10 hours) # starting from tomorrow morning at 10:30:00 # note that the program has run interval 0 and is run only once # in its run interval 3600 0 o log_system_state --something arguments # this is the first time the program should be run 2008-07-22 10:30:00 # the other run times are computed form this time and cycle value > # this is the start of another record. consider this program should # be run in an interval of time for example from '18:30:00' till # '20:30:00' everyday (cycle is equal to 86400 seconds and interval # is equal to 7200 seconds). # This program should be rerun if it is terminated. (something like a # ppp connection that you want to reconnect if disconnected) 86400 7200 r ppp_connection arguments # this is the first time the program should be run 2008-07-20 18:30:00 # no matter if the program's first run time is a time in # the past its next run time is computed from then, since the # the program should be run every cycle seconds > # this is a program you wish to be run on some specified times # 0 60 o some_program # run #1 2008-07-22 20:31:00 # run #2 # this overrides the interval variable by specifying when # interval finishes 2008-07-23 21:40:01 2008-07-23 21:50:00 # run #3 2008-07-24 21:00:00 # you might want to add some more run times till some other record # starts or the file finishes > # consider you want to download something from internet tonight # you should retry downloading if the downloader program terminates # with a non-zero value (consider the downloader returns 0 when # download had been finished). 0 0 s downloader url 2008-07-21 22:00:00 -----------------------* Sample Input File *-------------------------
Here is the above sample input file with no comments:
-----------------------* Sample Input File *------------------------- > 3600 0 o log_system_state --something arguments 2008-07-22 10:30:00 > 86400 7200 r ppp_connection arguments 2008-07-20 18:30:00 > 0 60 o some_program 2008-07-22 20:31:00 2008-07-23 21:40:01 2008-07-23 21:50:00 2008-07-24 21:00:00 > 0 0 s downloader url 2008-07-21 22:00:00 -----------------------* Sample Input File *-------------------------