Precautions for Foreground Operations in Alarm Scripts
To ensure continuous server availability, do not run certain foreground operations in an alarm script.
When the server invokes an alarm script, the server sometimes waits
for the script to complete before proceeding. For example:
- When an alarm is invoked because of a fatal error, the server waits for the script to finish writing information to the error log. In certain situations, alarm events 5 and 6 are run in the foreground.
- Some Enterprise Replication event alarms run in the foreground, such as event alarms 31, 34, 37, and 39.
Because the server might need to wait for the alarm program script
to finish, do not run the following operations in the foreground in
an alarm script:
- An onmode command that forces user connections off the server
such as
onmode -u
oronmode -yuk
. These kinds of onmode commands can cause a deadlock between the server and the alarm script because the server might wait for the alarm script to complete while the alarm script that executed the onmode command waits for the user sessions to shut down, and one of those sessions is running the alarm script itself. - Operations that might take a long time to complete or that have a highly variable run time. Operations that take a long time to complete can cause the server to appear as if it is not responding while the operation is running.
If you need to run the above operations in an alarm script, run them in the background using one of the following operating system utilities:
On UNIX™: Use the
nohup utility. For example, nohup onmode -yuk &
instructs
nohup to continue running the command even if its parent terminates
and the ampersand, &, runs the command in the
background so it will not block execution of the alarm program script
itself.
On Windows™: Use
the start utility with the /B flag. For example, start /B
onmode -yuk
.