Shutdown via SSH

Having difficulties when installing the system? Your system runs slowly and requires some tweaking? You can get help here.
Post Reply
User avatar

Topic author
ajbrehm
Valued Contributor
Posts: 62
Joined: Sun Jun 16, 2019 7:55 am
Reputation: 6
Location: Zurich
Status: Offline
Contact:

Shutdown via SSH

Post by ajbrehm » Sat Apr 09, 2022 5:19 pm

What's a good way to shutdown OpenVMS via SSH? Currently the shutdown.com procedure kills my sshd process and then aborts the shutdown.

User avatar

arne_v
Master
Posts: 299
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

Re: Shutdown via SSH

Post by arne_v » Sat Apr 09, 2022 9:38 pm

You could start a detached process doing the shutdown.
Arne
arne@vajhoej.dk
VMS user since 1986


jonesd
Valued Contributor
Posts: 74
Joined: Mon Aug 09, 2021 7:59 pm
Reputation: 0
Status: Offline

Re: Shutdown via SSH

Post by jonesd » Sat Apr 09, 2022 9:43 pm

$ mcr sysman shutdown node/minutes=0/invoke_shutdown


sodjan
Active Contributor
Posts: 39
Joined: Mon Apr 24, 2023 3:51 am
Reputation: 0
Status: Offline

Re: Shutdown via SSH

Post by sodjan » Mon Apr 24, 2023 3:56 am

Was some time ago, but we have a short COM file that, when run, runs itself as a detached process and performes a reboot.

Code: Select all

$IF F$MODE().NES."OTHER"
$THEN
$  RUN /DET /INP='F$ENVIRONMENT("PROCEDURE")' -
       /OUT=OPA0: /PRIV=ALL /UIC=[1,4] -
       SYS$SYSTEM:LOGINOUT
$ELSE
$  SET PROC/PRIV=ALL
$  ASS OPA0: SYS$COMMAND
$  @SYS$SYSTEM:SHUTDOWN 0 SHUTDOWN YES YES LATER YES NONE
$  WAIT 08:00
$ENDIF
Long time ago, I instead did a "set host/lat" from another VMS system and run the shutdown or reboot.
LAT lives long enough on the system shutting down, so that the system shuts down when LAT has been closed.

User avatar

m_detommaso
Valued Contributor
Posts: 66
Joined: Thu Jun 06, 2019 6:57 am
Reputation: 0
Location: Brindisi (Italy)
Status: Offline
Contact:

Re: Shutdown via SSH

Post by m_detommaso » Mon Apr 24, 2023 1:38 pm


20.12.2022 - SHUTDOWN V1.0 Patch Kit for OpenVMS IA64 and Alpha (AXP)

Note: this fix has been included in patch kit VMS92X_UPDATE-V0200 for x86-64 version V9.2 and in E9.2-1 release.


Installation Rating: INSTALL_2 - No reboot is necessary after installation of this kit.

Integrity

vms842l3i_shutdown-v0100, version(s) of VSI OpenVMS to which this kit may be applied:

• VSI OpenVMS for Integrity Servers V8.4-1H1
• VSI OpenVMS for Integrity Servers V8.4-2
• VSI OpenVMS for Integrity Servers V8.4-2L1
• VSI OpenVMS for Integrity Servers V8.4-2L3


KIT DEPENDENCIES

• VMS841H1I_NOTARY-V0200 (if installing on V8.4-1H1)
• VMS842I_NOTARY-V0200 (if installing on V8.4-2)

All VSI OpenVMS patch kits now require the Notary V2.0 patch kit for their respective version of VSI OpenVMS. This is to ensure correct validation regardless of the manifest version in use. The Notary V2.0 kit named above which matches the version of VSI OpenVMS being patched is required for this kit to install.

• VMS842L1I_UPDATE-V0100 (if installing on V8.4-2L1)

All new patch kits for VSI OpenVMS for Integrity Servers V8.4-2L1 require the VMS842L1I_UPDATE-V0100 kit.

• None (if installing on V8.4-2L3)


Alpha
vms842l2a_shutdown-v0100; version(s) of VSI OpenVMS to which this kit may be applied:

• VSI OpenVMS Alpha V8.4-2L1
• VSI OpenVMS Alpha V8.4-2L2


KIT DEPENDENCIES:

• VMS842L1A_NOTARY-V0200 (if installing on V8.4-2L1)
• VMS842L2A_NOTARY-V0200 (if installing on V8.4-2L2)

All VSI OpenVMS patch kits now require the Notary V2.0 patch kit for their respective version of VSI OpenVMS. This is to ensure correct validation regardless of the manifest version in use. The Notary V2.0 kit named above which matches the version of VSI OpenVMS being patched is required for this kit to install.



PROBLEMS ADDRESSED IN THIS KIT - Allow terminals connected via OpenSSH to run SHUTDOWN.COM

A process connected to an OpenVMS system via OpenSSH could not successfully shutdown or reboot the system using the SYS$SYSTEM:SHUTDOWN.COM procedure. The associated process running the SSH image was not recognized as required while the shutdown was in progress and would be deleted, which would leave the shutdown in limbo. Other network terminal types, including previous implementations of SSH, were correctly skipped over when the shutdown procedure deleted processes, which allowed the shutdown to complete. With this patch kit, OpenSSH terminal sessions are now correctly handled so that the user shutting down the system continues the shutdown process to the end.

NOTE: If you plan to allow users with SSH connected sessions to shutdown the system, do not invoke the SSH$SHUTDOWN.COM from within the site-specific SYS$MANAGER:SYSHUTDWN.COM procedure. The SSH shutdown will delete the process executing the shutdown and leave the system in an inconsistent state with logins and SSH disabled, along with some other parts of the system shutdown, but nothing left running to complete the shutdown or reboot.

Images and/or Files Affected:

[SYSEXE]SHUTDOWN.COM


/Maurizio
Last edited by m_detommaso on Tue Apr 25, 2023 2:00 am, edited 3 times in total.

Post Reply