Written by

Sr Application Development Analyst at The Ohio State University Wexner Medical Center
Question Scott Roth · Mar 7, 2023

Questions about using ZSTOP

I am working on setting up our Failover techniques as we move to a Mirror Environment with a Arbiter, 2 Failover Nodes, and a Async (DR) Node. There are some system commands that I would like to call when the Mirror moves, and I am working on a ZMIRROR routine for that, but I also wanted to create an additional step if we wanted to manually shutdown and for the Mirror to move. So I was looking at using ZSTOP to call a couple of different items while shutting down, while the documentation has an example a couple of questions come to mind about using ZSTOP.

  • If we use ZSTOP do I need to account for all steps for shutting down an instance, or is ZSTOP a way to add additional steps to the shutdown process?
  • If I create a ZSTOP will it replace the current built in shutdown process?
  • Does anyone have any good examples or tips/tricks when it comes to using ZSTOP?

Thanks

Scott

Product version: IRIS 2022.1
$ZV: IRIS for UNIX (Red Hat Enterprise Linux 8 for x86-64) 2022.1 (Build 209U) Tue May 31 2022 12:13:24 ED

Comments

Oliver Wilms · Mar 7, 2023

Hello, Scott, ZSTOP can be used to define additional code you want to run at shutdown. The normal shutdown will still happen if you have ZSTOP routine.

0
Scott Roth  Mar 8, 2023 to Oliver Wilms

The ZSTOP example in the documentation uses the ZUTIL method, does anyone have examples on how to code ZSTOP outside of the Documentation provided. 

0
Lorenzo Scalese  Mar 8, 2023 to Scott Roth

Hi @Scott Roth ,

Ten years ago, I implement %ZSTOP routine to execute code when a job process exits or when the instance shutdown.  I removed my code, but the routine looks like this: 

%ZSTOP; User shutdown routine. Quit
SYSTEM ; Cache stoppingSet oldNs = $NamespaceTry {
		Set$Namespace = "MYAPPNAMESPACE"; Do something when stopping the instance.
	}Catch(ex) {}
	
	Set$Namespace = oldNS
    Quit
LOGIN ; a user logs out of Cache (user account or telnet)QuitJOB; JOB'd process exits. If$Namespace = "MYAPPNAMESPACE" {
		; do something when job process exits
	}
    Quit
CALLIN ; process exits via CALLIN interface. Quit
Logit(entrypoint, caller) PRIVATE ;Quit
0