Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Update for script version 2.0

Anchor
TOC
TOC
Include Page
KBCOMMON:KB-CSSstyle
KBCOMMON:KB-CSSstyle

...

ParameterValueExample
logfileFull path to the logfile that will be used to log the script outputlogfile=C:\Charon\myds20_shutdown.log
mode'opa0'mode=opa0
osEither Tru64 or VMSos=Tru64
servicename

CHARON instance service name.

(warning) When using expect, the service is stopped by the expect script either with a "power off" or the "F6" key.

If this operation does not succeed (cannot connect to console or "F6" key not enabled for example), it is then stopped using a Windows service command.

servicename=myds20
usernameDefines the remote username that will be used to connect to the console of the CHARON instance (if not already logged in)

For OpenVMS: username=system

For Tru64: username=root

password

Defines the password in clear text that will be used to connect to the console.

The password can be also stored in an encrypted clixml file as described below.

(warning) If password is sent then clixml (below) value must be set to "none"

password=12345
clixml

Defines the full path of the clixml file that contains the encrypted password (password parameter must then not be set).

To create this file, open a "cmd.exe " window and then run :

C:\Users\Administrator> cd C:\Charon

C:\Charon> powershell

PS C:\Charon> "<password>" | export-clixml <file>


Example:

PS C:\Charon> "12345" | export-clixml C:\Charon\myds20pwd.clixml

(warning) The clixml file is bound to the user and system where it is created! It will not be valid for another user or another system.

clixml=C:\Charon\myds20pwd.clixml
clixmlsys

Defines the full path of the clixml file that contains the encrypted password (password parameter must then not be set) for the "system" account. Used in case of integration with Windows shutdown.

(info) If not specified, clixml is used or the combination of username/password (see above)

(warning) The clixml file has to be created as "system" user using "psexec" utility. It is bound to the "system" user and the system where it is created! It will not be valid for another user or another system.

clixml=C:\Charon\myds20pwdsys.clixml
portDefines the port to access the console (same as the one defined in the configuration file).port=10003
prompt

Defines the prompt at the shell level of the guest operating system. Used

by 'expect' to check that the connection did succeed

to check the user is connected.

Notes:

  • If the prompt contain spaces, it is necessary to add them in the configuration file
  • The prompt must not contain any escape character.

prompt=myds20>

timelimitsecDefines the maximum number of seconds the script can run (default = 180 seconds). This value depends on the time needed to shutdown properly the operating system.timelimitsec=600
windowwidth

Optional parameters used to resize the window when running with service user ("system" account).

Useful during Windows shutdown to check operations executed.

Width = 132 and Height = 32 by default. BufferHeight set 2000 lines by default.

windowwidth=120
windowheightwindowheight=50

...


Div
classcommandline

#-----------------------------------------

# myds20 Tru64 V5.1 machine

#-----------------------------------------

windowwidth=132
windowheight=50

logfile=C:\Charon\myds20pluto_shutdown.log
servicenamewaitbeforestop=myds2010

modeservicename=opa0pluto
os=Tru64
username=root

mode=opa0
clixml=C:\Charon\pluto_tru64.clixml
clixmlsys=C:\Charon\myds20pwdpluto_tru64sys.clixml
clixml=none
password=charon0
port=1000310004
prompt=# pluto#
timelimitsec=180


Include Page
KBCOMMON:KB-GoToTop
KBCOMMON:KB-GoToTop

...

(info) When check mode is enabled, a pop-up window will be displayed to check the expect operations performed on the CHARON instance console.


Div
classcommandline

c:\Windows\system32>C:\charon\Charon>powershell -file charon_cleanshutdown.ps1 -config myds20tru64C:\charon\pluto_tru64.ini -check

Charon clean shutdown

Name            Value
----            -----
clixmlsys       C:\Charon\pluto_tru64sys.clixml
waitbeforestop  10
windowwidth     132
servicename     pluto
username        root
prompt          pluto#
windowheight    50
timelimitsec    180
os              Tru64
mode            opa0
clixml          C:\Charon\pluto_tru64.clixml
port            10004
logfile         C:\Charon\pluto_shutdown.log

16:37:38 [INFO ] Using 'C:\Charon\pluto_shutdown.log' as log file / append
16:37:38 [INFO ] Execution date : 27-->To updateavr.-2020 16:37:38
16:37:38 [INFO ] Script version : 27-Apr-20 V2.0 (MD5: 4BA97792A105C9E0E484850B88B866F8 )
16:37:38 [INFO ] Powershell version : 5.1.14409.1018
16:37:38 [INFO ] Computer name : WIN2008BM
16:37:38 [INFO ] Username : Administrateur
16:37:38 [INFO ] Windows version : Microsoft Windows Server 2008 R2 Standard
16:37:38 [INFO ] Administrator mode : True
16:37:38 [INFO ]
16:37:38 [INFO ] Check mode enabled.
16:37:38 [INFO ] 'opa0' will be used
16:37:38 [INFO ] Service 'pluto' is Running (Display name: pluto)
16:37:38 [INFO ] Using 'C:\Charon\pluto_tru64.clixml' as credentials file.
16:37:38 [INFO ] Killing putty sessions...
16:37:39 [INFO ] Done.
16:37:39 [INFO ] Connecting to OPA0 console, port 10004
16:37:39 [INFO ] Sending CRLF...
16:37:39 [INFO ] Time limit: 16:40:39. Seconds remaining: 180
16:37:43 [RCVD ]
16:37:43 [RCVD ] #####################
16:37:43 [RCVD ] # pluto demo system #
16:37:43 [RCVD ] #####################
16:37:43 [RCVD ]
16:37:43 [RCVD ] HP Tru64 UNIX V5.1B (Rev. 2650) (pluto) console
16:37:43 [RCVD ]
16:37:43 [RCVD ] login:
16:37:43 [RCVD ]
16:37:43 [RCVD ] #####################
16:37:43 [RCVD ] # pluto demo system #
16:37:43 [RCVD ] #####################
16:37:43 [RCVD ]
16:37:43 [RCVD ] HP Tru64 UNIX V5.1B (Rev. 2650) (pluto) console
16:37:43 [RCVD ]
16:37:43 [RCVD ] login:
16:37:43 [INFO ] Got: [login: ]
16:37:43 [INFO ] Sending Tru64 username...
16:37:43 [INFO ] Username sent
16:37:43 [INFO ] Time limit: 16:40:39. Seconds remaining: 176
16:37:46 [RCVD ] root
16:37:46 [RCVD ] Password:
16:37:46 [INFO ] Got: [Password:]
16:37:46 [INFO ] Sending password, try #1 of 3
16:37:46 [INFO ] Password sent
16:37:48 [INFO ] Time limit: 16:40:39. Seconds remaining: 171
16:37:52 [RCVD ]
16:37:52 [RCVD ] Last login: Mon Apr 27 16:33:20 CEST 2020 on console
16:37:52 [RCVD ] HP Tru64 UNIX V5.1B (Rev. 2650); Thu Sep 12 12:04:06 CEST 2013
16:37:52 [RCVD ] Compaq Tru64 UNIX V5.1B (Rev. 2650); Thu Sep 12 11:11:39 CEST 2013
16:37:52 [RCVD ]
16:37:52 [RCVD ] The installation software has successfully installed your system.
16:37:52 [RCVD ]
16:37:52 [RCVD ] There are logfiles that contain a record of your installation. These are:
16:37:52 [RCVD ]
16:37:52 [RCVD ] /var/adm/smlogs/install.cdf - configuration description file
16:37:52 [RCVD ] /var/adm/smlogs/install.log - general log file
16:37:52 [RCVD ] /var/adm/smlogs/install.FS.log - file system creation logs
16:37:52 [RCVD ] /var/adm/smlogs/setld.log - log for the setld(8) utility
16:37:52 [RCVD ] /var/adm/smlogs/fverify.log - verification log file
16:37:52 [RCVD ]
16:37:52 [RCVD ]
16:37:52 [RCVD ] You have new mail.
16:37:52 [RCVD ] pluto#
16:37:52 [INFO ] Got: [pluto# ]
16:37:52 [INFO ] Found prompt.
16:37:52 [INFO ] Check mode enabled: sending test command...
16:37:52 [INFO ] Command sent
16:37:57 [INFO ] Time limit: 16:40:39. Seconds remaining: 162
16:38:01 [RCVD ] /usr/bin/uname -a;echo RESULT=$?
16:38:01 [RCVD ] OSF1 pluto V5.1 2650 alpha
16:38:01 [RCVD ] RESULT=0
16:38:01 [INFO ] Remote command succeeded
16:38:01 [RCVD ] pluto# pluto#
16:38:01 [RCVD ] pluto#
16:38:01 [INFO ] Got: [pluto# ]
16:38:01 [INFO ] Check mode enabled: prompt found, login out...
16:38:01 [INFO ] Done.
16:38:01 [INFO ] Check mode enabled: the service pluto will not be stopped
16:38:01 [INFO ] Service pluto is Running
16:38:01 [INFO ] Script ended.

(question) RCVD messages correspond to the received data from the OPA0 console.

Include Page
KBCOMMON:KB-GoToTop
KBCOMMON:KB-GoToTop

Shutdown execution - Tru64 example


Div
classcommandline

c:\Windows\system32>C:\charon\charon_cleanshutdown.ps1 -config C:\charon\pluto_tru64.ini

Charon clean shutdown

Name            Value
----            -----
clixmlsys       C:\Charon\pluto_tru64sys.clixml
waitbeforestop  10
windowwidth     132
servicename     pluto
username        root
prompt          pluto#
windowheight    50
timelimitsec    180
os              Tru64
mode            opa0
clixml          C:\Charon\pluto_tru64.clixml
port            10004
logfile         C:\Charon\pluto_shutdown.log

16:40:51 [INFO ] Using 'C:\Charon>powershell -file charon_cleanshutdown.ps1 -config myds20tru64.ini-->To update\Charon\pluto_shutdown.log' as log file / append
16:40:51 [INFO ] Execution date : 27-avr.-2020 16:40:51
16:40:51 [INFO ] Script version : 27-Apr-20 V2.0 (MD5: 4BA97792A105C9E0E484850B88B866F8 )
16:40:51 [INFO ] Powershell version : 5.1.14409.1018
16:40:51 [INFO ] Computer name : WIN2008BM
16:40:51 [INFO ] Username : Administrateur
16:40:51 [INFO ] Windows version : Microsoft Windows Server 2008 R2 Standard
16:40:51 [INFO ] Administrator mode : True
16:40:51 [INFO ]
16:40:51 [INFO ] 'opa0' will be used
16:40:51 [INFO ] Service 'pluto' is Running (Display name: pluto)
16:40:51 [INFO ] Using 'C:\Charon\pluto_tru64.clixml' as credentials file.
16:40:51 [INFO ] No putty session active.
16:40:51 [INFO ] Connecting to OPA0 console, port 10004
16:40:51 [INFO ] Sending CRLF...
16:40:51 [INFO ] Time limit: 16:43:51. Seconds remaining: 180
16:40:55 [RCVD ]
16:40:55 [RCVD ] #####################
16:40:55 [RCVD ] # pluto demo system #
16:40:55 [RCVD ] #####################
16:40:55 [RCVD ]
16:40:55 [RCVD ] HP Tru64 UNIX V5.1B (Rev. 2650) (pluto) console
16:40:55 [RCVD ]
16:40:55 [RCVD ] login:
16:40:55 [RCVD ]
16:40:55 [RCVD ] #####################
16:40:55 [RCVD ] # pluto demo system #
16:40:55 [RCVD ] #####################
16:40:55 [RCVD ]
16:40:55 [RCVD ] HP Tru64 UNIX V5.1B (Rev. 2650) (pluto) console
16:40:55 [RCVD ]
16:40:55 [RCVD ] login:
16:40:55 [INFO ] Got: [login: ]
16:40:55 [INFO ] Sending Tru64 username...
16:40:55 [INFO ] Username sent
16:40:55 [INFO ] Time limit: 16:43:51. Seconds remaining: 176
16:40:58 [RCVD ] root
16:40:58 [RCVD ] Password:
16:40:58 [INFO ] Got: [Password:]
16:40:58 [INFO ] Sending password, try #1 of 3
16:40:58 [INFO ] Password sent
16:41:00 [INFO ] Time limit: 16:43:51. Seconds remaining: 171
16:41:04 [RCVD ]
16:41:04 [RCVD ] Last login: Mon Apr 27 16:38:22 CEST 2020 on console
16:41:04 [RCVD ] HP Tru64 UNIX V5.1B (Rev. 2650); Thu Sep 12 12:04:06 CEST 2013
16:41:04 [RCVD ] Compaq Tru64 UNIX V5.1B (Rev. 2650); Thu Sep 12 11:11:39 CEST 2013
16:41:04 [RCVD ]
16:41:04 [RCVD ] The installation software has successfully installed your system.
16:41:04 [RCVD ]
16:41:04 [RCVD ] There are logfiles that contain a record of your installation. These are:
16:41:04 [RCVD ]
16:41:04 [RCVD ] /var/adm/smlogs/install.cdf - configuration description file
16:41:04 [RCVD ] /var/adm/smlogs/install.log - general log file
16:41:04 [RCVD ] /var/adm/smlogs/install.FS.log - file system creation logs
16:41:04 [RCVD ] /var/adm/smlogs/setld.log - log for the setld(8) utility
16:41:04 [RCVD ] /var/adm/smlogs/fverify.log - verification log file
16:41:04 [RCVD ]
16:41:04 [RCVD ]
16:41:04 [RCVD ] You have new mail.
16:41:04 [RCVD ] pluto#
16:41:04 [INFO ] Got: [pluto# ]
16:41:04 [INFO ] Found prompt.
16:41:04 [INFO ] Send Tru64 shutdown...
16:41:04 [INFO ] Command sent
16:41:09 [INFO ] Time limit: 16:43:51. Seconds remaining: 162
16:41:13 [RCVD ] /sbin/init 0;echo RESULT=$?
16:41:13 [RCVD ] RESULT=0
16:41:13 [INFO ] Remote command succeeded
16:41:13 [RCVD ] pluto# pluto#
16:41:13 [RCVD ] pluto#
16:41:13 [INFO ] Got: [pluto# ]
16:41:13 [INFO ] Found prompt, waiting for shutdown to start...
16:41:18 [INFO ] Time limit: 16:43:51. Seconds remaining: 153
16:41:21 [RCVD ]
16:41:21 [RCVD ] INIT: New run level: 0
16:41:21 [RCVD ] The system is coming down. Please wait...
16:41:21 [RCVD ] Logins disabled
16:41:21 [RCVD ]
16:41:21 [INFO ] Got: [Logins disabled]
16:41:21 [INFO ] Shutdown in progress...
16:41:23 [INFO ] Time limit: 16:43:51. Seconds remaining: 148
16:41:27 [RCVD ] LAT stopped.
16:41:27 [RCVD ]
16:41:27 [INFO ] Got: [LAT stopped.]
16:41:27 [INFO ] Case unknown: [LAT stopped.]. Retrying...
16:41:29 [INFO ] Time limit: 16:43:51. Seconds remaining: 142
16:41:32 [RCVD ] Unmounting NFS filesystems
16:41:32 [RCVD ]
16:41:32 [INFO ] Got: [Unmounting NFS filesystems]
16:41:32 [INFO ] Case unknown: [Unmounting NFS filesystems]. Retrying...
16:41:34 [INFO ] Time limit: 16:43:51. Seconds remaining: 137
16:41:38 [RCVD ]
16:41:38 [RCVD ] Halting processes ...
16:41:38 [RCVD ]
16:41:38 [INFO ] Got: [Halting processes ...]
16:41:38 [INFO ] Halting processes ...
16:41:38 [INFO ] Time limit: 16:43:51. Seconds remaining: 133
16:41:41 [RCVD ] The system is down.
16:41:41 [RCVD ]
16:41:42 [INFO ] Got: [The system is down.]
16:41:42 [INFO ] The system is down.
16:41:42 [INFO ] Time limit: 16:43:51. Seconds remaining: 130
16:41:45 [INFO ] Timeout #1...
16:41:47 [INFO ] Time limit: 16:43:51. Seconds remaining: 124
16:41:51 [RCVD ] /proc: Invalid argument
16:41:51 [RCVD ] ....Halt completed....
16:41:51 [RCVD ] syncing disks... done
16:41:51 [RCVD ] CPU 0: Halting... (transferring to monitor)
16:41:51 [RCVD ]
16:41:51 [RCVD ] halted CPU 0
16:41:51 [RCVD ]
16:41:51 [RCVD ] halt code = 5
16:41:51 [RCVD ] HALT instruction executed
16:41:51 [RCVD ] PC = ffffffff0048a5f0
16:41:51 [RCVD ] P00>>>
16:41:51 [INFO ] Got: [P00>>>]
16:41:51 [INFO ] Sending 'power off'...
16:41:52 [INFO ] Service pluto is stopped
16:41:52 [INFO ] Script ended.

(question) RCVD messages correspond to the received data from the OPA0 console.

Shutdown execution - VMS example


Div
classcommandline

c:\Windows\system32>C:\charon\charon_cleanshutdown.ps1 -config C:\charon\myds20vms.ini

Charon clean shutdown

Name            Value
----            -----
clixmlsys       C:\Charon\myds20vmssys.clixml
waitbeforestop  10
windowwidth     132
servicename     ds20vms
username        system
prompt          VMS084>
windowheight    50
timelimitsec    180
os              VMS
mode            opa0
clixml          C:\Charon\myds20vms.clixml
port            10003
logfile         C:\Charon\myds20vms_shutdown.log



16:48:09 [INFO ] Using 'C:\Charon\myds20vms_shutdown.log' as log file / append
16:48:09 [INFO ] Execution date : 27-avr.-2020 16:48:09
16:48:09 [INFO ] Script version : 27-Apr-20 V2.0 (MD5: 4BA97792A105C9E0E484850B88B866F8 )
16:48:09 [INFO ] Powershell version : 5.1.14409.1018
16:48:09 [INFO ] Computer name : WIN2008BM
16:48:09 [INFO ] Username : Administrateur
16:48:09 [INFO ] Windows version : Microsoft Windows Server 2008 R2 Standard
16:48:09 [INFO ] Administrator mode : True
16:48:09 [INFO ]
16:48:09 [INFO ] 'opa0' will be used
16:48:09 [INFO ] Service 'ds20vms' is Running (Display name: ds20vms)
16:48:09 [INFO ] Using 'C:\Charon\myds20vms.clixml' as credentials file.
16:48:09 [INFO ] No putty session active.
16:48:09 [INFO ] Connecting to OPA0 console, port 10003
16:48:09 [INFO ] Sending CRLF...
16:48:09 [INFO ] Time limit: 16:51:09. Seconds remaining: 180
16:48:12 [RCVD ]
16:48:12 [RCVD ] Welcome to OpenVMS (TM) Alpha Operating System, Version V8.4
16:48:12 [RCVD ]
16:48:12 [RCVD ] Username:
16:48:12 [INFO ] Got: [Username: ]
16:48:12 [INFO ] Sending VMS username...
16:48:12 [INFO ] Username sent
16:48:12 [INFO ] Time limit: 16:51:09. Seconds remaining: 176
16:48:16 [RCVD ] system
16:48:16 [RCVD ] Password:
16:48:16 [INFO ] Got: [Password: ]
16:48:16 [INFO ] Sending password, try #1 of 3
16:48:16 [INFO ] Password sent
16:48:18 [INFO ] Time limit: 16:51:09. Seconds remaining: 171
16:48:21 [RCVD ]
16:48:21 [RCVD ] %LOGIN-S-LOGOPRCON, login allowed from OPA0:
16:48:21 [RCVD ] Welcome to OpenVMS (TM) Alpha Operating System, Version V8.4
16:48:21 [RCVD ] Last interactive login on Monday, 27-APR-2020 15:46:31.39
16:48:21 [RCVD ] Last non-interactive login on Thursday, 2-APR-2020 08:18:02.76[c\Z
16:48:21 [INFO ] Got: [ Last non-interactive login on Thursday, 2-APR-2020 08:18:02.76[c\Z]
16:48:22 [INFO ] Case unknown: [ Last non-interactive login on Thursday, 2-APR-2020 08:18:02.76[c\Z]. Retrying...
16:48:24 [INFO ] Time limit: 16:51:09. Seconds remaining: 165
16:48:27 [RCVD ] [0c
16:48:27 [INFO ] Got: [[0c]
16:48:27 [INFO ] Case unknown: [[0c]. Retrying...
16:48:29 [INFO ] Time limit: 16:51:09. Seconds remaining: 160
16:48:33 [RCVD ]
16:48:33 [RCVD ] %SET-W-NOTSET, error modifying OPA0:
16:48:33 [RCVD ] -SET-I-UNKTERM, unknown terminal type
16:48:33 [RCVD ] VMS084>
16:48:33 [INFO ] Got: [ VMS084> ]
16:48:33 [INFO ] Found prompt.
16:48:33 [INFO ] Sending VMS shutdown...
16:48:33 [INFO ] Command sent
16:48:38 [INFO ] Time limit: 16:51:09. Seconds remaining: 151
16:48:42 [RCVD ] @SYS$MANAGER:CHARON_SHUTDOWN.COM
16:48:42 [RCVD ] $ PURGE /KEEP=20 SYS$MANAGER:CHARON_SHUTDOWN.LOG
16:48:42 [RCVD ] $ RUN /DETACH SYS$SYSTEM:LOGINOUT.EXE /INPUT=SYS$MANAGER:CHARON_SHUTDOWN -
16:48:42 [RCVD ] /OUTPUT=SYS$MANAGER:CHARON_SHUTDOWN.LOG /UIC=[1,4]
16:48:42 [RCVD ] %RUN-S-PROC_ID, identification of created process is 0000011F
16:48:42 [RCVD ] $ ENDIF
16:48:42 [RCVD ] $ ENDIF
16:48:42 [RCVD ] $ EXIT
16:48:42 [RCVD ] VMS084>
16:48:42 [RCVD ]
16:48:42 [RCVD ]
16:48:42 [RCVD ] SHUTDOWN -- Perform an Orderly System Shutdown
16:48:42 [RCVD ] on node VMS084
16:48:42 [RCVD ]
16:48:42 [RCVD ] %SHUTDOWN-I-OPERATOR, this terminal is now an operator's console
16:48:42 [RCVD ] %SHUTDOWN-I-DISLOGINS, interactive logins will now be disabled
16:48:42 [RCVD ] %SET-I-INTSET, login interactive limit = 0, current interactive value = 1
16:48:42 [RCVD ] %SHUTDOWN-I-STOPQUEUES, the queues on this node will now be stopped
16:48:42 [RCVD ] %%%%%%%%%%% OPCOM 27-APR-2020 15:47:36.02 %%%%%%%%%%%
16:48:42 [RCVD ] Message from user SYSTEM on VMS084
16:48:42 [RCVD ] %JBC-E-OPENERR, error opening SYS$COMMON:[SYSEXE]QMAN$MASTER.DAT;
16:48:42 [RCVD ]

... (truncated)

16:48:42 [RCVD ]
16:48:42 [RCVD ] VMS084>
16:48:42 [INFO ] Got: [ VMS084> ]
16:48:42 [INFO ] Found prompt, waiting for shutdown to start...
16:48:47 [INFO ] Time limit: 16:51:09. Seconds remaining: 142
16:48:51 [RCVD ]
16:48:51 [RCVD ] SYSTEM SHUTDOWN COMPLETE
16:48:51 [RCVD ]
16:48:51 [RCVD ] halted CPU 0
16:48:51 [RCVD ]
16:48:51 [RCVD ] halt code = 5
16:48:51 [RCVD ] HALT instruction executed
16:48:51 [RCVD ] PC = ffffffff8008fa84
16:48:51 [RCVD ] P00>>>
16:48:51 [INFO ] Got: [P00>>>]
16:48:51 [INFO ] Sending 'power off'...
16:48:52 [INFO ] Service ds20vms is stopped
16:48:52 [INFO ] Script ended.



Include Page
KBCOMMON:KB-GoToTop
KBCOMMON:KB-GoToTop