home *** CD-ROM | disk | FTP | other *** search
-
- OS/2 LAN Server Shutdown command-line utility
-
- Copyright (C) 1993 Dimitri Vulis
-
- This program is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation; either version 1, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- this program; if not, write to the Free Software Foundation, Inc., 675 Mass
- Ave, Cambridge, MA 02139, USA.
-
- Description:
-
- The purpose of this short utility is to shut down an IBM LAN Server network
- server gracefully. I've found it incovenient to walk over to the server and go
- through PM to shut it down. Also if you try to shutdown without first issuing
- NET STOP on all the services, it occasionally dumps registers and abends. Just
- turning off the server with open HPFS files has caused disk corruption,
- requiring lengthy recovery. This little utility is my answer to the problems
- I've encountered. I hope it'll help others.
-
- What this program does (see the source code for the exact details):
-
- 1. It tries to close all the files that are open via the server. (Not the
- locally open files, I don't know how to do that). This is equivalent to issuing
- NET FILE nnnn /CLOSE for each remotely open file.
-
- 2. It issues NET USE resource /D for all USEd network resources. This is not
- strictly necessary, and it will not delete, e.g., a network drive which is the
- current drive for some process.
-
- 3. It likewise closes all the sessions via NET SESSION /D. It does not log out
- users to update the DCDB; I don't know how to do that, but would like to know.
-
- 4. It tries to stop all the network services. It issues NET START to list
- running services, issues NET STOP name to each, waits 1/10 of a second, then
- does it again; if a service hasn't stopped after 10 seconds, it's probably
- hung, so it goes on to the next step.
-
- 5. It asks OS/2 to flush disk buffers and shut down the file system. Unlike
- the shutdown routine in the desktop menu, it does not ask you to confirm
- whether you want to shutdown (which is impossible remotely).
-
- 6. It beeps for 1 second and freezes. At this point, according to the
- documentation, it should be safe to turn off or reset (via Ctrl-Alt-Del) the
- server (provided the disk light is off). If you press something else, like
- Ctrl-Break, Ctrl-Esc, Ctrl-Alt-NumLock, etc, after the beep, you may get a
- register dump, a blank screen, etc, but you can't do anything useful once
- DosShutdown has returned.
-
- If you're invoking LSSHDOWN via NET ADMIN from a workstation, you'll get back
- messages NET3502 and SYS0240 indicating that the network connection has been
- lost (not suprisingly).
-
- The network calls use C:\MUGLIB\DLL\NETAPI.DLL, not present in vanilla OS/2
- 2.0, so the executable won't run without the LAN Server's requester.
-
- Please e-mail your comments to me at DLV@DM.COM.
-
- Usage:
-
- path\LSSHDOWN
-
- There are no arguments and no output except the final beep.
-
- Conveniently, the program can also be invoked remotely from a workstation:
-
- NET ADMIN \\server /COMMAND path\LSSHDOWN
-
- (You need to be logged on the workstation with PRIV:ADMIN or OPER:SERVER,
- but you need not be logged on the server.)
-
- and timed via AT:
-
- AT 13:00 path\LSSHDOWN
-
- You can even put it on the server's desktop (there's an icon inside the
- .EXE file) by running this REXX .CMD script:
-
- /* If you don't want it on the desktop, replace <WP_DESKTOP> (location)
- by something like <WP_OS2SYS> */
-
- call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
- call sysloadfuncs
-
- result = SysCreateObject('WPProgram', 'NShutdown', '<WP_DESKTOP>',,
- 'EXENAME=M:\UTIL\BINP\LSSHDOWN.EXE;PROGTYPE=PM;OBJECTID=<SRV_SHUTDOWN>', 'U')
-
- ZIP file contents:
-
- LSSHDOWN.DOC this file
- LSSHDOWN.EXE executable
- MAKEFILE make file
- LSSHDOWN.C source files
- LSSHDOWN.DEF
- LSSHDOWN.ICO
- LSSHDOWN.RC
- COPYING GNU licence
-