 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
Tim
Joined: 09 Oct 2001 Posts: 36
|
|
Job Processing |
|
I have some dynamic jobs which run external batch files. I want these processes to update a database so it logs the start and finsih time. I can do this when the job is running a script, but not an external file, hence i want to dynamically change the dynamic job tasks so it calls an external JAL file whcih contains these scripts. The external JAL file essentially has a case statment which determines if the job has started or finsihed, and will execute the statement accordingly. The reason why it needs to write to a database, is because this database is to be accessed by a web application which displayus the current status of the jobs.
|
|
Sun Nov 14, 2004 8:04 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7969
|
|
Re: Job Processing |
|
I suggest instead of coding all this as scripts you simply use "database" notification actions. In the action SQL script (an INSERT statement or stored procedure perhaps) you can use @V"event" macro-parameter whose you can then use as a filter in your web/database reports or in the "if" logic of the stored procedure. This design is much cleaner then putting everything into a single job script. You would simply have a program type job to launch your batch file with job notification actions selected on "startup" and "finish" and perhaps on "error" events that will insert status messages into your database. I still don't get why you need to modify jobs dynamically, why not code the database logging function as user-defined function with parameters and call it from job scripts (of course if the solution suggested above is not good)? About web application and dynamic status of jobs: Are you aware of HTML job status reports option in 24x7? Maybe it can do what you want? Turning on HTML reports is as simple as one click in the Options dialog, Log page. Do you know about 24x7 Web-based Management Console? : I have some dynamic jobs which run external batch files. : I want these processes to update a database so it logs the start and finsih : time. I can do this when the job is running a script, but not an external : file, hence i want to dynamically change the dynamic job tasks so it calls : an external JAL file whcih contains these scripts. : The external JAL file essentially has a case statment which determines if the : job has started or finsihed, and will execute the statement accordingly. : The reason why it needs to write to a database, is because this database is : to be accessed by a web application which displayus the current status of : the jobs.
|
|
Sun Nov 14, 2004 11:35 pm |
|
 |
Tim
Joined: 09 Oct 2001 Posts: 36
|
|
Re: Job Processing |
|
: I have some dynamic jobs which run external batch files. : I want these processes to update a database so it logs the start and finsih : time. I can do this when the job is running a script, but not an external : file, hence i want to dynamically change the dynamic job tasks so it calls : an external JAL file whcih contains these scripts. : The external JAL file essentially has a case statment which determines if the : job has started or finsihed, and will execute the statement accordingly. : The reason why it needs to write to a database, is because this database is : to be accessed by a web application which displayus the current status of : the jobs. continuing on from the other thread.. where @V"event didnt work properly i saw in another post where it was mentioned that: "@V"event" and several other macro-variables are specific to their place of executuon (let's call them event script-level visibility) while other are available to the entire job (let's call them job-level visibility) " What can i do to get @V"event to work in my situation? (having it inside a script library code) sorry for dragging this on for so long. I just keep running into problem after problem. Thanks.
|
|
Sun Nov 14, 2004 11:37 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7969
|
|
Re: Job Processing |
|
That's right @V"event" can be used in notification scripts only. If you need this value in a user-defined statement pass it as a parameter. For example, if your user-defined statement definition is MyFunction(string event_type, number option) and it returns number then you can call it fro ma notification script like below Dim( result, number ) MyFunction( "@V"event"", 1, result) If it does not return anything and has no parameters other then the event_type then the call as simple as MyFunction( "@V"event"") : continuing on from the other thread.. where @V"event didnt work properly : i saw in another post where it was mentioned that: "@V"event" : and several other macro-variables are specific to their place of executuon : (let's call them event script-level visibility) while other are available : to the entire job (let's call them job-level visibility) " : What can i do to get @V"event to work in my situation? (having it inside : a script library code) : sorry for dragging this on for so long. I just keep running into problem : after problem. Thanks.
|
|
Mon Nov 15, 2004 1:15 pm |
|
 |
Tim
Joined: 09 Oct 2001 Posts: 36
|
|
Re: Job Processing |
|
: That's right @V"event" can be used in notification scripts only. If : you need this value in a user-defined statement pass it as a parameter. : For example, if your user-defined statement definition is MyFunction(string : event_type, number option) and it returns number then you can call it fro : ma notification script like below : Dim( result, number ) : MyFunction( "@V"event"", 1, result) : If it does not return anything and has no parameters other then the : event_type then the call as simple as : MyFunction( "@V"event"") Hi , that works for me thanks. But only when i manually put the MyFunction( "@V"event"") code in the job notifiation script box. when i try to do it via the job modify function and have "MyFunction( "@V"event"")" as the script it only puts MyFunction() in the modified job's job notification script. This also happens when i try to debug a job with only MyFunction( "@V"event"") in it. When the debugging screen opens, it only has MyFunction() showing.
|
|
Mon Nov 15, 2004 7:46 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7969
|
|
Re: Job Processing |
|
That's because @V"event" has no value at that time. It only has a value when the notification event is invoked during job normal run-time. Here is how you can make it to work JobModify( 484, "MSG_SCRIPT_CODE", "MyFunction(\"@V\"event\"\")" ) : Hi , that works for me thanks. But only when i manually put the MyFunction( : "@V"event"") code in the job notifiation script box. : when i try to do it via the job modify function and have "MyFunction( : "@V"event"")" as the script it only puts : MyFunction() in the modified job's job notification script. : This also happens when i try to debug a job with only MyFunction( : "@V"event"") in it. When the debugging screen opens, : it only has MyFunction() showing.
|
|
Mon Nov 15, 2004 8:00 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7969
|
|
Re: Job Processing |
|
By the way, I figured out how you can dynamically insert @SCRIPT tag into a dynamically created job Here is an example (the idea is not to have "@SCRIPT:" in the creator job). Dim( var, string ) Concat( "@", "SCRIPT:c:\\dir1\\file1.jal", var ) JobModify( @V"job_id", "MSG_SCRIPT_CODE", var ) Sorry, I still don't get why you are creating dynamic jobs and scripts, why simply not to use variables in a static job/script. : That's because @V"event" has no value at that time. It only has a : value when the notification event is invoked during job normal run-time. : Here is how you can make it to work : JobModify( 484, "MSG_SCRIPT_CODE", : "MyFunction(\"@V\"event\"\")" )
|
|
Mon Nov 15, 2004 8:11 pm |
|
 |
Tim
Joined: 09 Oct 2001 Posts: 36
|
|
Re: Job Processing |
|
: That's because @V"event" has no value at that time. It only has a : value when the notification event is invoked during job normal run-time. : Here is how you can make it to work : JobModify( 484, "MSG_SCRIPT_CODE", : "MyFunction(\"@V\"event\"\")" ) excellent, thankyou. you've been a great help.
|
|
Mon Nov 15, 2004 8:20 pm |
|
 |
L.MOHANARANGAN
Joined: 27 Nov 2004 Posts: 1
|
|
Re: Job Processing |
|
: I suggest instead of coding all this as scripts you simply use : "database" notification actions. In the action SQL script (an : INSERT statement or stored procedure perhaps) you can use : @V"event" macro-parameter whose you can then use as a filter in : your web/database reports or in the "if" logic of the stored : procedure. This design is much cleaner then putting everything into a : single job script. You would simply have a program type job to launch your : batch file with job notification actions selected on "startup" : and "finish" and perhaps on "error" events that will : insert status messages into your database. : I still don't get why you need to modify jobs dynamically, why not code the : database logging function as user-defined function with parameters and : call it from job scripts (of course if the solution suggested above is not : good)? : About web application and dynamic status of jobs: Are you aware of HTML job : status reports option in 24x7? Maybe it can do what you want? Turning on : HTML reports is as simple as one click in the Options dialog, Log page. : Do you know about 24x7 Web-based Management Console?
|
|
Sat Nov 27, 2004 8:16 am |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|