The ProTop scheduler configuration can instruct the DBMonitor process to execute tasks.
The configuration file follows basic Unix cron syntax, with the addition of the optional “[NOALERT]” modifier.
0 * * * 6 foreachdb.sh dbanalys.sh > ${PTTMP}/foreachdb_dbanal.err 2>&1 [NOALERT]
By default, an information (blue) alert is uploaded to the ProTop web portal when a scheduled process is executed. The addition of [NOALERT] parameter prevents that upload. Read the top of the scheduler.cfg file for more detail.
Note: If you do not already have a localized version, copy etc/schedule.cfg to etc/schedule.[*].cfg. e.g. etc/schedule.yourCustId.cfg or etc/schedule.yourServerName.cfg. Edit your localized file and not the original etc/schedule.cfg file, which is overwritten at each update of ProTop.
foreachdb.sh[bat]
As found in [PROTOPDIR]/etc/schedule.cfg, foreachdb.sh (example above) will execute the given command against databases listed in etc/dblist.cfg AND has the “monitor” flag set to “yes” AND and belongs to the current server.
It does not work with every ProTop script or batch file, i.e., hc.[sh|bat], so test and check the logs.
On Windows
If you want the ProTop Scheduler to run jobs in parallel, give each command a unique log file name. If you do not, subsequent commands attempting to use the same log file will fail.
NOTE: Ensure the log file you redirect monitor output to in the schedule starts with "tasksched", as in "tasksched.logmon.err". This ensures the scheduler's output stream (run by dbmonitor) and the monitor's output stream (the bat file following "cmd") do not conflict.
Non Blocking
As of ProTop 328, the task Scheduler no longer blocks while running a task.
The task scheduler runs within the context of the “dbmonitor” process. Because dbmonitor controls starting and stopping agents for resources, dbmonitor must not block for any substantial period of time, since that would prevent timely action on .lg messages, launching or stopping pt3agents, or acting on outages. This requires modification of the task scheduler, which currently, by default, blocks when a process is run and waits for it to complete.
In practice, most scheduled tasks are set up to run in the background without blocking, but the current code (Pre-328) required the user to remember to add an “&” to the command line to achieve this. This is no longer required.
Related
Please take a look at this article on using the Scheduler to Keep your ProTop Installation Up to date.