TN - 1030 Ensure Dream Reports Automatically Generate
Description
You can configure Dream Reports to automatically run in the project properties by setting the Start Mode to Run as a service and defining the project to start. In some instances, however, you may notice Dream Reports does not always run. This article explains how to create a Watchdog mechanism, which controls the project status and reloads it in case of any failure.
- Author: Mario Meza
- Published: 9/18/2017
- Applies to: Dream Reports 4.83 and above
The idea is to run a batch file, which checks the current project status and depending on the result, performs the corresponding action.
A project can have 4 possible states:
1. No project is running
2. Generator.exe is not running
3. LoggerRt.exe is not running
4. The project is running OK.
When the batch file is started, it returns one of 4 numbers, and in case of 1, 2, or 3, it starts the defined project.
The batch file can be accessed from the following link
Once you’ve placed the .bat file you will want to update it with the path to the desired project. To do this open the file with an editor, such as notepad++.
You should see something similar to the image (below).
We need to update the path(s) in yellow (above) to reflect the current path of the desired project. You can get this information by navigating to the project and SHIFT+RB on the desired application and selecting the option ‘Copy as Path’. Replace the items in yellow with the path to your project and save.
Once the path has been updated, the simplest way to get this working is to place the .bat file in the startup folder. You can right click on the .bat file, create a shortcut and paste the shortcut in the start-up folder.
To access the start-up folder, from Run enter shell:startup
This will take you right to the start-up directory in your system. Paste the Shortcut.
You can validate this works by clearing the Auto-Start configurations to their defaults for the project and reboot the machine.
You should see that the project will automatically enter a running state. Note: you may see the command prompt remain open until the system is done loading and the RTM enters a running state. The window should then automatically close. (This may take a couple minutes)
You also have the option to set up a Scheduled Task. This may actually be the most reliable option since it has some additional logic for error handling. You can also enable the logger for the task, so should it ever encounter an issue, you have a place to start an investigation. This was option was tested on Server 2016 by creating a Scheduled Task with the following settings.
General:
Run whether user is logged on or not
Run with the highest privileges
Configured for Windows Server 2016
Trigger
Task begins At startup
Delay task for : 1 minute
Stop task if it runs linger that : 30 minutes
Enabled
Action
Action : Start a program
Program/Script (Path to where the .bat file resides this is the FULL Path. Copy as Path and remove the “”)
Start in (The directory where the .bat file resides)
Settings
Allow task to be run on demand
Run task as soon as possible after a scheduled start is missed
If the task fails restart every : 1 minute
Attempt to restart up to : 3 times
Stop the task if the task runs longer than 1 hour
If the running task is not end when requested, force it to stop
It is recommended to maintain the Auto Start configurations in the DR project outlined at the start of this article. This .bat file is just a fail safe for those instances when the application fails to load due to some unknown reason.
Here are some interesting things about...