Script Schedule

I have several (SQL) scripts. Most of them have some requirements: other scripts that must be executed earlier.

You can represent the combined dependency trees as a directed graph. I would like to be able to "invalidate" a certain node in the graph, which will lead to the creation of a composite script that contains everything (in the correct order) that must be re-run in order to reach the ready state.

I'm thinking of something like a Debian startup process ... with a twist.

Edit: If someone needs an explicit question starting with W and ending with a question mark, the closest I can give is: How can I achieve the behavior described above.

Edit2: The ideal solution is that it scans files that match the template and reads information about the dependence on the first (comment) line.

+5
source share
3 answers

You can use make. Create a naming convention for stamp files (possibly use log files from scripts). Makefile can be generated using a script. Example:

stamp1: stamp2 stamp3 script1.sql
     sql <script1.sql > $@

stamp2: stamp3 stamp5 script2.sql
     sql <script2.sql > $@

...

EDIT: Makefile . 1 " " {2, 3, script3.sql}: - , (sql < > ) . , 1 2, .

+4

[, . ]

. . http://en.wikipedia.org/wiki/Topological_sorting, :

( )

, , ( ).

, , ( , "" node, ) ( , ).

ps, , , . , , , .

+2

, "" , ? :

- , L:

  • = 1
  • L [i]
  • L [i] ​​ L, , 1
  • Else = + 1, Goto 3
+1

All Articles