winsmaug1.8b/area/imc/
winsmaug1.8b/boards/
winsmaug1.8b/councils/
winsmaug1.8b/deity/
winsmaug1.8b/doc/mudprogs/
winsmaug1.8b/gods/
winsmaug1.8b/houses/
winsmaug1.8b/log/
winsmaug1.8b/player/l/
winsmaug1.8b/vault/
winsmaug1.8b/watch/
Installing the SMAUG server as a service
----------------------------------------

	by Nick Gammon - nick@gammon.com.au

	12th February 1998


Reading this file
-----------------

This file was created with Notepad. 

If the paragraphs do not wrap around properly:

Set "Word Wrap" on the Edit menu.


What is a service?
------------------

Services are programs that are automatically started up as Windows NT boots, they do not wait for someone to log on.

For examples of existing services on your PC, open the Control Panel, and then open the "Services" icon.

Why install SMAUG as a service?
-------------------------------

1. SMAUG will start automatically as soon as the PC boots, it does not need someone to log onto an account.
2. You can leave SMAUG running even if no-one is logged on. This is especially useful if you are planning to run 24 hours a day, but want to have some security protecting you from people who might access the PC in your absence.
3. SMAUG closes down in an orderly way if the PC is shut down (assuming that you do a proper Windows NT shutdown, and don't just turn off the power switch).


Manual or automatic start
-------------------------

When you first install SMAUG as a service it is marked as "automatic start" which means that it will start up automatically every time you boot the PC. However, you can use the "Services" Control Panel to make the startup manual, and then only start it when desired.


Access rights
-------------

If you get an error message "Access is denied" when attempting to install the service, you will need to either:

a) Log out, and log back in as Administrator; or
b) Use the "User Manager for Domains" (in Adminstrative Tools) to give your account the *advanced* user right of "Log on as a service".


Installing SMAUG as a service
--------------------------------

1. First, test it stand-alone. This is to check that all files are being found, and that there are no error messages on startup. To do this, start a  DOS window (Command Prompt), change to SMAUG directory, and type:

SMAUG /run

2. Log into SMAUG using Telnet or a MUD client program, and check that all is OK.

3. Shut SMAUG down by entering "shutdown mud now" as a wizard, or pressing Ctrl-C in the DOS window.

4. Install the service by typing:

SMAUG /install

You should get the message "Service successfully installed"

5. Start the service by typing:

SMAUG /start

You should get the message "Start request sent to service"

6. After waiting about 15 seconds for the service to start up, test it by logging into SMAUG by using Telnet or your MUD client.

7. That's it!


Starting the service
--------------------

You only need to start the service manually:

a) The first time you install it; or
b) If you have shut SMAUG down (e.g. by doing a @shutdown)

To start the service manually type (at a DOS prompt):

SMAUG /start

You should get the message "Start request sent to service"


If you want to *always* start the service manually:

a) Go to the Control Panel
b) Open the "Services" icon
c) Scroll down until you have found "SMAUG for Win32"
d) Click on "SMAUG for Win32" so that it is selected (highlighted)
e) Click on "Startup"
f) Click on "Manual"


Stopping the service
--------------------

You can stop the service (i.e. SMAUG) by:

a) Doing a "shutdown mud now" as a wizard character; or

b) Going to the DOS prompt (ie. Open a "Command Prompt" window) and type:

SMAUG /stop


Pausing the service
-------------------

You can pause the service (I'm not sure how useful this is) by clicking on "Pause" in the "Services" Control Panel when you have "SMAUG" highlighted. To resume it, click on "Continue".

A paused service is halted, but will resume when you click on Continue. You might do this to see what effect SMAUG has on the rest of your PC by pausing it briefly and seeing if that has any effect on other programs.


Removing the service
--------------------

To permanently de-install the service, start a DOS window (Command Prompt), change to SMAUG directory, and type:

SMAUG /remove

Note that you cannot remove the service while it is running. You will have to shut SMAUG down first (ie. type: SMAUG /stop).


Finding the status of the service
---------------------------------

To find if SMAUG service is running or not, type:

SMAUG /status


Game output
-----------

The output from the game (initial information, connects etc.) are written to the file LOG\GAME.LOG if SMAUG is running as a service. You can use NotePad or another word processor to inspect this file at any time. This might be useful if SMAUG has crashed or not start up correctly.


Help on the various options
---------------------------

At a DOS prompt, type: 

SMAUG /help

You should see the following display:

Usage is :-
 SMAUG           - runs as a service, or stand-alone
 SMAUG /run      - runs stand-alone
 SMAUG /start    - starts this service
 SMAUG /stop     - stops this service
 SMAUG /install  - installs this service
 SMAUG /remove   - removes (un-installs) this service
 SMAUG /status   - displays the status of this service
 SMAUG /help     - displays this information


Windows 95
----------

Note that you cannot run SMAUG as a service under Windows 95. This operating system does not support services, and does not have a "Services" item in the Control Panel.

You can only install SMAUG as a service under Windows NT or Windows NT Server.


Network drives
--------------

Experience has shown that you cannot successfully install SMAUG as a service from a network drive. You must install from a local drive. e.g. C:\SMAUG , not N:\SMAUG


Moving SMAUG
---------------

If you move or rename the directory containing SMAUG you will have to remove the service and reinstall it. This is because the full pathname to SMAUG.EXE is stored by the system at installation time.


Shutting down the system
------------------------

Somewhat to my surprise, it seems that shutting down Windows NT does not automatically send a "stop" message to all running services. In order to work around this (so that the database is saved) I have put code in to detect a shutdown. However, for safety's sake, you may wish to do one of the following prior to shutting down your PC:

a) Log in as a wizard, and do a "shutdown mud now";  OR
b) Use a DOS window, and type: "SMAUG /stop"; OR
c) Use the "Services" icon in the Control Panel to "stop" the SMAUG service; OR
d) Set up an icon in the Program Manager which runs: SMAUG /stop

Having done one of the above, wait a few seconds, before shutting down the PC itself.