I found myself in the not-so-comfortable situation of working with a Linux system on which someone had accidentally disabled user access to the Linux shell. HealthConnect was running, servicing hundreds of interfaces. To resolve the access issue, though, we needed to bring the host down for the application of a fix.
Without the shell, the iris command is not available to control the instance, so we were faced with the potential of shutting down the server ungracefully. We wanted to avoid that if possible ...
The ^SHUTDOWN routine was historically an option for shutting down Cache, but you need a terminal session to execute it (We'll be talking more about what qualifies as a terminal session in a minute). But ^SHUTDOWN is now deprecated, and when you execute it, you get the message "Please use the 'iris stop' procedure to shut down the system."
So cross that off the list ... and replace it with INTNOSHUT^SHUTDOWN. Yes, running this command will gracefully halt IRIS. And yes, you need an IRIS command shell to execute it. So where do you get an IRIS command shell for the system you're locked out of, you ask?
In the not-long-for-this-world IRIS Studio, of course! The Output window allows you to execute IRIS commands, and this won't be a surprise to many. It will certainly allow you to run D INTNOSHUT^SHUTDOWN in the output window (after switching to the %SYS namespace). However, if you do exactly that IRIS will most likely start to shut down and then hang, since Studio keeps a session open. It may never completely shut down, and you would have no way to force it down other than to halt the operating system.
That said, you can achieve a full shutdown by using the command JOB INTNOSHUT^SHUTDOWN, then immediately exiting Studio. IRIS will (more likely than not) shutdown gracefully and you can feel better about doing things the "right" way ... even if it feels wrong.
As far as regaining user access to the Linux shell is concerned, that's a topic for another forum. But now that IRIS is safely shut down, the issue with access can be resolved (some disassembly probably required).
nice, another option here is to create a scheduled task in IRIS to call this, set the task to be called OnDemand and voila you can trigger a shutdown from SMP.
An option that can be performed without Studio, also nice! (You do need VS Code though)
And @Robert Cemper's solution can be performed exclusively via the Management Console, which is also a great alternative.
I'm guessing that the WebSocket Terminal would also provide IRIS command shell access without an ssh session but I haven't played with that yet.
I don't think you actually need VS Code to do this - you should be able to call the routine using RunLegacyTask, which lets you write code as part of the task instance definition.
another hack:
Example:
CREATE PROCEDURE ANY.NAME() LANGUAGE OBJECTSCRIPT { ;;; fill in whatever you want to do }
Maybe Webterminal could be an option too
I use this on Windows to automatically restart any instance. Probably simply changing "\" by "/" will do the trick, and change stopstart for stop:
It has happened to me a few time not having access to terminal (OS or IRIS).
For this situation I developed a quick and dirty CSP class to allow me to execute IRIS or OS commands.
Class SomePackege.Cmd Extends %CSP.Page { ClassMethod OnPage() As %Status { &html<<html> <head> </head> <body> <form> <input type="text" name="cmdOS" size="150" value='#(%request.Get("cmdOS"))#'> <input type="submit" value="runOS" onclick="this.form.submitted.value=this.value;" > <br/> <input type="text" name="cmd" size="150" value='#(%request.Get("cmd"))#'> <input type="submit" value="runCMD" onclick="this.form.submitted.value=this.value;" > <input type="hidden" name="submitted"> </form> > If (%request.Get("submitted")="runOS") && (%request.Get("cmdOS")'="") { Set cmdOS=%request.Get("cmdOS") Set io=$io Open cmdOS:"QR" Write "<tt>" Try { For Use cmdOS Read line Use io Write $replace(..EscapeHTML(line)," "," "),"<br>" } Catch CatchError { Set sc=CatchError.AsStatus() } Use io Write "</tt>" Close cmdOS Use io } ElseIf (%request.Get("submitted")="runCMD") && (%request.Get("cmd")'="") { Set cmd=%request.Get("cmd") Write "<pre>" x cmd Write "</pre>" } &html<</body> </html>> Quit $$$OK } }
Once the class is loaded (say, from Studio or VS code) in one namespace, just call it from the default csp/web application, for example:
http://yourhost:57772/csp/user/SomePackage.Cmd.cls
Please note that the UI is very, very, VERY rudimental (ugly), but gets the job done in case of need.