====== Synchronet Windows Services ======

(a.k.a. Synchronet NT Services)

If you're running Synchronet on a Microsoft Windows NT based operating system
(e.g. Windows NT, Windows 2000, Windows XP, Windows 2003, Windows Vista, Windows 2008, Windows 7, Windows 8, or Windows 10), you can run
Synchronet as a set of [[wp>Windows Services]].

===== Executable =====

The Synchronet Windows Services are hosted by a native executable program.

The executable file is: ''[[dir:exec]]/sbbsNTsvcs.exe''

===== Advantages =====

When run as services, Synchronet will start before the Windows Logon prompt is displayed and will run without a user logged in. Windows Services can be protected from being monitored or controlled (e.g. shutdown) by any user but the computer administrator.

===== Services =====

The Synchronet Windows Services executable (''sbbsNTsvcs.exe'') includes five (5) Windows Services that handle all the
functionality of Synchronet-Win32 (''sbbs.exe'' or ''sbbsctrl.exe''):

^Name                 ^Description^
|SynchronetBBS        |Synchronet Terminal Server|
|SynchronetFTP        |Synchronet FTP Server|
|SynchronetWeb        |Synchronet Web Server|
|SynchronetMail       |Synchronet Mail Server|
|SynchronetServices   |Synchronet Services|

===== Installation =====

You should shutdown the [[sbbsctrl|Synchronet Control Panel]] (GUI) before installing the
Synchronet Windows services.

You may install, disable, or remove each Windows service independently, or all at
once. 

To install all the Synchronet Windows Services at once, run:

	sbbsNTsvcs install

Example output:
<file>
Synchronet NT Services  Version 3.15a  Copyright 2010 Rob Swindell

Installing Synchronet NT Services...
Installing service: Synchronet Terminal Server          ... Startup: Automatic
Installing service: Synchronet FTP Server               ... Startup: Automatic
Installing service: Synchronet Web Server               ... Startup: Automatic
Installing service: Synchronet SMTP/POP3 Mail Server    ... Startup: Automatic
Installing service: Synchronet Services                 ... Startup: Automatic
</file>
===== Configuration =====

The configuration of the Synchronet [[:server:|Servers]] and [[:service:|Services]] is handled in your
Synchronet initialization files (i.e. ''[[config:sbbs.ini]]'' and ''[[config:services.ini]]'').

The Synchronet Windows
services know the location of your Synchronet ''[[dir:ctrl]]'' directory from the
''[[:config:env#SBBSCTRL]]'' environment variable.

Once installed, the Synchronet Windows services may be started from the Windows Services
dialog (under the Windows Control Panel->Administrative Tools->Services),

{{:monitor:services_cpl.png|}}

by running the [[monitor:sbbsctrl|Synchronet Control Panel]], or if the system is rebooted, the
services will start automatically if enabled and configured for "AutoStart".

The Windows Services control panel applet may also be started with Windows Start->Run->''services.msc''.

{{:monitor:run_services_msc.png|}}

===== Command Line =====

Run ''sbbsNTsvcs -?'' from a command prompt to see the 
available command-line options. Example:
<file>
Usage: sbbsntsvcs [command] [service]

If service name not specified, default is ALL services.

Available Commands:

list                 to list services
install              to install services
remove               to remove serivces
disable              to disable services
enable               to re-enable disabled services
start                to start services
stop                 to stop services
recycle              to recycle services
mute                 to mute (sounds of) services
unmute               to unmute (sounds of) services
</file>

For example, to recycle the Synchronet Web Server service, run:

	sbbsNTsvcs recycle web

===== Control =====
Synchronet Windows Services, like most Windows Services, can also be controlled with the Windows ''net.exe'' and ''sc.exe'' utilities.

Example:
  net start SynchronetBBS
 
Example: 
  sc stop SynchronetWeb
  
Example output:
<file>
SERVICE_NAME: SynchronetWeb
        TYPE               : 20  WIN32_SHARE_PROCESS
        STATE              : 3  STOP_PENDING
                                (STOPPABLE,NOT_PAUSABLE,ACCEPTS_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x7530
</file>  
To start or stop all Synchronet Windows Services at once from a command-line, use the ''sbbsNTsvcs'' commands.

Example:
  sbbsNTsvcs start

Example output:
<file>
Synchronet NT Services  Version 3.15a  Copyright 2010 Rob Swindell

Starting service: Synchronet Terminal Server          ... Started
Starting service: Synchronet FTP Server               ... Started
Starting service: Synchronet Web Server               ... Started
Starting service: Synchronet SMTP/POP3 Mail Server    ... Started
Starting service: Synchronet Services                 ... Started
</file> 

===== Synchronet Control Panel =====

The [[sbbsctrl|Synchronet Control Panel]] can be used to start,
stop, configure, recycle, and monitor the Synchronet Windows services once installed, but it
is not required for operation. If the Synchronet Control Panel is not running,
the BBS servers will still function, even if no user is logged into Windows.

You cannot "spy" on a BBS node running as an Windows service and the "Clients"
window and the optional "Tray icon" in the Synchronet Control Panel will not
reflect active clients connected to Synchronet Windows services. There are plans to
integrate these features with the Synchronet Windows services in the future.

NOTE: For the Synchronet Control Panel to correctly communicate with the Windows Service Control Manager, sbbsctrl.exe may need to be run "as administrator". Not doing so may cause the Synchronet Control Panel to not be able to discover that the NT services are installed or running and it won't be able to control (e.g. start/stop) or communicate with the services.
===== Windows Event Log =====
Log messages (determined by the ''LogLevel'' values in your ''[[:config:sbbs.ini]]'' file) will be logged as Application event log messages (viewable in your Windows Event Viewer). 

You may wish to configure your Windows Event Log to overwrite old messages
as needed:

  - Open the Event Viewer (e.g. from Control Panel->Administrative Tools)
  - Right click Application Log, Select Properties
  - Set the maximum log size to something like 8192 (8MB) or bigger
  - Select "Overwrite events as needed" or "older x days"

===== Debug Output =====
If you wish to use a Windows debug output viewer (such as [[http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx|DebugView]]) to view the log
output of one or more of the Synchronet Windows Services, set the "Start
parameters" of one or more of the services (under the Windows Control Panel)
to ''-debug''.

===== Uninstallation =====

If you do not wish to run Synchronet as Windows Services (e.g. run them in-process using ''[[monitor:sbbscon|sbbs.exe]]'' or ''[[monitor:sbbsctrl|sbbsctrl.exe]]'' instead), simply stopping and (optionally) disabling the services is all that is normally required.

To disable the Synchronet Windows Services using ''sbbsNTsvcs'':

  sbbsNTsvcs disable
  
Example output:
<file>
Synchronet NT Services  Version 3.15a  Copyright 2010 Rob Swindell

Disabling service: Synchronet Terminal Server          ... Disabled
Disabling service: Synchronet FTP Server               ... Disabled
Disabling service: Synchronet Web Server               ... Disabled
Disabling service: Synchronet SMTP/POP3 Mail Server    ... Disabled
Disabling service: Synchronet Services                 ... Disabled
</file>

To remove/un-install the Synchronet Windows Services, run:

	sbbsNTsvcs remove

Example output:
<file>
Synchronet NT Services  Version 3.15a  Copyright 2010 Rob Swindell

Removing: Synchronet Terminal Server          ... Removed
Removing: Synchronet FTP Server               ... Removed
Removing: Synchronet Web Server               ... Removed
Removing: Synchronet SMTP/POP3 Mail Server    ... Removed
Removing: Synchronet Services                 ... Removed
</file>

:!: This operation does not uninstall Synchronet.

===== See Also =====
  * [[:monitor:|Monitoring]]

{{tag>}}