# Filename: PRESHUT # # Courtesy of Beechglen Development # 4219 Harrison Avenue # Cincinnati, Ohio 45211 # (513) 922-0509 # http://www.beechglen.com # mailto:support@beechglen.com # # Unsupported freeware. Beechglen assumes no liability # for use or misuse of this script. # # # Change history. 3/16/2004 Added disk space check. Systems # with less than < 16384 sectors # free space won't boot with # NMSGDT1A, NMSGDT2A, or NMSGDV1A # =============================================================== echo echo This script should be run prior to a system shutdown to echo gracefully stop processing. If there are any batch jobs running echo it is your responsibility to verify that they can be aborted echo with no adverse effects on the system echo # setvar hpautocont,true setvar InvVideo,chr(27) + "&dB" limit 0,0 # =============================================================== if hpaccount <> "SYS" or hpuser <> "MANAGER" or hpldevin <> 20 then echo echo You must be logged on as MANAGER.SYS on LDEV 20 to echo execute this script. echo return endif # =============================================================== # - Prompt section. Answer questions here # echo echo I will be creating a copy of the current configuration echo to the group PREVCFG.SYS If for some reason you need to echo reboot the system to get back to this known point in time echo (for instance the new configuration is bad) then you can echo issue the ISL command START NORECOVERY GROUP=PREVCFG echo echo Press [Return] to continue echo input Answer # # - Ask if any configuration listings are needed. # echo echo !InvVideo Are you shutting down for system maintenance? echo echo If you are planning to work on or change hardware echo components you MUST power off all connected devices. echo SCSI adapters and their connected devices are especially echo vulnerable to blown fuses or damage when maintenance echo is performed while they are running. echo echo Additionally, because the results of maintenance are echo never guaranteed, it is prudent to have an SLT and a echo backup prior to any of these functions. echo input CreateSLT,'!InvVideo Would you like me to create an SLT?' setvar CreateSLT,lft(ups(CreateSLT),1) echo If you are shutting down to perform an operating system echo update; or to install, replace, or repair hardware; you echo should have a current configuration listing. echo input PrintConfigList,'!InvVideo Would you like me to produce & a configuration listing?' setvar PrintConfigList,lft(ups(PrintConfigList),1) # =============================================================== # -- Shut down ESP data collection. There is a timing conflict # during a system shutdown where active processes that access # the file system after it has been closed potentially can # cause a system abort before the system reaches SHUT 6. # ESP/3000 is susceptible to this bug. if finfo("/ESP","EXISTS") then echo !InvVideo Shutting down ESP/3000 data collection. purge ESPRUN.PUB.SYS >$null endif # =============================================================== # -- Verify that the creator of SYSSTART.PUB.SYS is MANAGER.SYS # If not, it will not execute during bootup. if finfo("SYSSTART.PUB.SYS","EXISTS") then if finfo("SYSSTART.PUB.SYS","OWNER") <> "MANAGER.SYS" then altfile sysstart.pub.sys;owner=MANAGER.SYS;groupid=SYS echo echo !InvVideo I corrected the creator of SYSSTART.PUB.SYS to echo !InvVideo be MANAGER.SYS echo endif endif # =============================================================== # -- Shut down network services. If you run SNA you should put # your SNACONTROL shutdown commands in this section as well. echo !InvVideo Shutting down network transport services. ABORTJOB FTP.SYS ABORTJOB INETD,MANAGER.SYS NSCONTROL STOP NSCONTROL ABORT NETCONTROL STOP setvar NETRunning,"Y" while NETRunning = "Y" file testit=netcp.net.sys;exc continue setvar hpfserr,0 print *testit;out=$null;end=1 >$null if hpfserr = 90 or hpfserr = 91 then pause 5 else setvar NETRunning,"N" endif endwhile echo echo Network transport services shutdown is complete. echo # =============================================================== # -- Verify NMCONFIG FILE.If the DTS or NS subsystems are not # validated then validate them. # Run NMMGRVAL with parm=1 to set variables that indicate # which subsystems in NMCONFIG are not validated. # For any that are not, create a script to automatically # validate. echo echo !InvVideo Checking NMCONFIG file for non-validated subsystems. echo nmmgrval.pub.sys,1 setvar ValAny, VALDTS + VALNETXPORT + VALIBM + VALOSI if ValAny > 0 then purge NMMGRCMD,temp >$null build NMMGRCMD;rec=-80,,f,ascii;temp file nmcmd=nmmgrcmd,oldtemp;dev=disc echo openconf nmconfig.pub.sys >>*nmcmd if VALDTS > 0 then echo The DTS subsystem is not validated. I will validate it. echo validateconf dts >>*nmcmd endif if VALNETXPORT > 0 then echo NETXPORT subsystem is not validated. I will validate it. echo validateconf netxport >>*nmcmd endif if VALIBM > 0 then echo The IBM subsystem is not validated. I will validate it. echo validateconf ibm >>*nmcmd endif if VALOSI > 0 then echo The OSI subsystem is not validated. I will validate it. echo validateconf osi >>*nmcmd endif echo exit >>*nmcmd file formlist=$stdlist file nmmgrcmd,oldtemp;dev=disc echo Validating selected subsystems. nmmgr reset nmmgrcmd reset formlist reset nmcmd purge nmmgrcmd,temp else echo All NMCONFIG subsystems are validated. echo endif # =============================================================== # # - Create backup copy of the current system configuration. # echo echo !InvVideo Create a copy of the current system configuration. echo purge sysgin,temp >$null build sysgin;rec=-80,,f,ascii;temp file sgcmd=sysgin,oldtemp;dev=disc echo @.pub.sys,@.net.sys;directory;show >indfile echo permyes on >>*sgcmd echo keep >>*sgcmd echo exit >>*sgcmd file sysgin,oldtemp;dev=disc sysgen bootup,prevcfg # =============================================================== if CreateSLT = "Y" then purge sysgin,temp >$null build sysgin;rec=-80,,f,ascii;temp file sgcmd=sysgin,oldtemp;dev=disc echo @.pub.sys,@.net.sys;directory;show >indfile echo tape store=^indfile >>*sgcmd echo exit >>*sgcmd file sysgin,oldtemp;dev=disc sysgen config if cierror <> 0 then echo echo !InvVideo =================================== echo !InvVideo The SLT is BAD! Do not unless you echo !InvVideo know you can recover without it. echo !InvVideo =================================== echo endif purge sysgin,temp purge indfile,temp reset sgcmd reset sysgin endif if PrintConfigList = "Y" then purge sysgin,temp >$null build sysgin;rec=-80,,f,ascii;temp file sgcmd=sysgin,oldtemp;dev=disc echo io >>*sgcmd echo ld >>*sgcmd echo lp >>*sgcmd echo exit >>*sgcmd echo exit >>*sgcmd file sysgout;dev=lp file sysgin,oldtemp;dev=disc sysgen config echo echo !InvVideo Config listing has been produce on device LP. echo purge sysgin,temp reset sysgout reset sgcmd reset sysgin endif echo # =============================================================== # # - Check to see if ESP/3000 has shut down. If not, # wait for it. It should take no longer than 2 minutes # or so from the time it is signalled. if finfo("/ESP","EXISTS") then setvar ESPRunning,"Y" setvar NumTries,0 while ESPRunning = "Y" file testit=espmain.pub.esp;exc continue setvar hpfserr,0 print *testit;out=$null;end=1 >$null if hpfserr = 90 or hpfserr = 91 then setvar NumTries,Numtries + 1 if NumTries = 1 then echo echo ESP/3000 is still running. Waiting for it to echo completely shutdown. This should take no more echo 2 minutes. endif pause 10 else setvar ESPRunning,"N" endif endwhile endif # =============================================================== # Disk space check section # Check for critically low disk space on system volset that # could prevent the system from rebooting. See SR8606351808 # Also check for contiguous disk space on LDEV 1 that could # prevent update from SLT. echo echo Checking free disk space on MPEXL_SYSTEM_VOLUME_SET echo (1 sector = 256 bytes) echo deletevar _c_@ >$null purge chkdisk1 >$null build chkdisk1;rec=-80,,f,ascii;disc=100;nocctl file chkdisk1=chkdisk1,old discfree.pub.sys "d,,mpexl_system_volume_set" >*chkdisk1 purge chkdisk2,temp > $null grep.hpbin.sys "'AVAIL TO' CHKDISK1" > CHKDISK2 file chkdisk2=chkdisk2,oldtemp input _c_chkdisk2_rec < *chkdisk2 setvar _c_avail_trans_sectors str('!_c_chkdisk2_rec',24,-34) setvar _c_avail_perm_sectors str('!_c_chkdisk2_rec',62,-72) setvar _c_avail_trans repl("!_c_avail_trans_sectors",' ','0') setvar _c_avail_perm repl("!_c_avail_perm_sectors",' ','0') setvar _c_avail_trans_n !_c_avail_trans setvar _c_avail_perm_n !_c_avail_perm # ...the following data sourced from ":discfree d" output... # !_c_avail_perm_n permanent sectors exist on the sysvolset. # !_c_avail_trans_n transient sectors exist on the sysvolset. if _c_avail_perm_n < 100000 echo ![InvVideo]There are less than 100,000 permanent sectors echo ![InvVideo]available on the system volume set. echo echo Some systems have been known to completely fail to reboot echo when critically low on permanent disk space. echo echo Contact Beechglen at (513) 922-0509 for assistance with echo cleaning up disk space. Use BIGFILES.PUB.ESP (download echo the latest version it from http://www.beechglen.com) echo to identify large files that are targets for removal to echo free up disk space. echo echo ![InvVideo]It is recommended that you NOT continue with this echo ![InvVideo]system shutdown until you have remedied this disk echo ![InvVideo]space situation. echo echo Press [RETURN] to continue echo input Answer else echo Free disk space OK for the purposes of rebooting echo endif echo echo Checking fragmented disk space on LDEV 1. echo purge chkdisk1 > $null purge chkdisk2,temp > $null purge chkdisk3 > $null build chkdisk3;rec=-80,,f,ascii;disc=100;nocctl file chkdisk3=chkdisk3,old discfree.pub.sys "a,1" >*chkdisk3 purge chkdisk4,temp > $null xeq grep.hpbin.sys "'-AND UP' CHKDISK3" >CHKDISK4 file chkdisk4=chkdisk4,oldtemp input _c_chkdisk4_rec < *chkdisk4 setvar _c_free_contig_nbr100blks str('!_c_chkdisk4_rec',1,-6) setvar _c_free_contig_100ksects str('!_c_chkdisk4_rec',52,-61) setvar _c_free_nbr100blks repl("!_c_free_contig_nbr100blks",' ','0') setvar _c_free_100ksects repl("!_c_free_contig_100ksects",' ','0') setvar _c_free_nbr100blks_n !_c_free_nbr100blks setvar _c_free_100ksects_n !_c_free_100ksects purge chkdisk3 > $null purge chkdisk4,temp > $null # the following data sourced from ":discfree 'a,1'" output... # !_c_free_nbr100blks_n (100,000+) sector blocks are on ldev #1 # and these blocks add up to !_c_free_100ksects_n sectors total. if _c_free_100ksects_n < 200000 echo ![InvVideo]Overall there is less than 200,000 contiguous echo ![InvVideo]sectors of permanent disk space on LDEV 1. echo echo Having such a small amount of contiguous echo permanent disk space on LDEV #1 could prevent echo an UPDATE from CSLT operation from succeeding. echo echo It is suggested you take steps to free up contiguous echo permanent disk space on LDEV 1. Feel free to call echo Beechglen at (513) 922-0509 for assistance. echo echo Press [RETURN] to continue echo input Answer else echo Fragmented disk space check on LDEV 1 results are OK echo for the purposes of rebooting. echo endif # =============================================================== echo echo SHUTDOWN pre-processing has completed. You may now shut echo the system down after any actions listed above are complete. echo Press CTL-A then type in SHUTDOWN and press [RETURN]. echo # ===============================================================