0

I have two executable (E1, E2) where E1 runs every 5 minutes and triggers E2 only when a particular condition is met. I could trigger E2 with changing code in E1 and run E1 via windows scheduler, however the problem is i got couple of more executable with dependency, which can be done by changing code but it adds more complexity in maintenance.

is there any provision in Windows scheduler where i can read the return value from a executable / script and then decide to call another executable? something configurable steps like we have in SQL Job.

I this can be done by BMC Patrol just looking for simpler solution.

Thanks!

Ramu
  • 343
  • 1
  • 6
  • 21
  • for clarity, you have access to the code for each of the programs? – tatmanblue Jan 08 '18 at 17:00
  • yes i do have, but i would prefer Executable(E1) to do its job and just return a code where the scheduler decides to call the subsequent Exe(E2) or not. – Ramu Jan 08 '18 at 17:03
  • So you could write some data to a file, then read the file from a scheduled job, then? – Magoo Jan 08 '18 at 17:07
  • @Magoo, Yes, could do it. But, still it needs change in code of both E1 & E2. Just trying to avoid it. Looking for solution something like set a variable / return a value to the scheduler and let it decide if it needs to call the subsequent program or not. Thanks. – Ramu Jan 08 '18 at 17:16
  • You can set `errorlevel` - details are language-dependent, but Delphi is `halt(num)`. Then a batch job scheduled by the scheduler is simple - `E1/if %errorlevel%==num E2` (on 2 separate lines) – Magoo Jan 08 '18 at 17:34
  • I'm looking for something like this in .Net please – Ramu Jan 08 '18 at 17:37
  • use Enviroment.Exit(?) see https://stackoverflow.com/questions/155610/how-do-i-specify-the-exit-code-of-a-console-application-in-net – tatmanblue Jan 08 '18 at 21:16
  • @tatmanblue How can i read the code in Scheduler and decide if i need to run E2 or not? any ideas please? – Ramu Jan 09 '18 at 00:21
  • @Ramu heres one example: https://msdn.microsoft.com/en-us/library/windows/desktop/aa383448(v=vs.85).aspx – tatmanblue Jan 09 '18 at 15:44

0 Answers0