To allow ATSD to run as a standard service and be controlled by the Windows Services Applet, we provide a module named ATSDSRV.EXE which acts as a service "wrapper", essentially just launching ATSD.EXE. Before installing or launching ATSDSRV.EXE, you must edit the initialization file ATSDSRV.INI (which should be in the same directory as ATSDSRV.EXE.) The typical INI file (which you can edit with Notepad) looks like this:
[Settings]
ServiceName=A-Shell Telnet Server (ATS)
ProcCount=1
CheckProcessSeconds=30
[Process0]
CommandLine=c:\vm\miame\bin\atsd.exe -z -i c:\vm\miame.ini -a c:\vm\miame\bin65\ashw32.exe -proto2 -p 23122 -l c:\vm\miame\atsdlog.log login
PauseStart=1
PauseEnd=1
UserInterface=No
Restart=Yes
In most cases, CommandLine is the only parameter you really need to change. UserInterface in theory would allow the service to interact with (be visible on) the desktop, but in most modern Windows Server environments, this capability has been disabled, so UserInterface=No is the standard option. Restart determines whether the service is automatically restarted if it should die, and the related CheckProcessSeconds determines how often the service is probed for life signs. ServiceName determines how the service appears in the Windows Services applet. Feel free to change it to match your application name; the only downside is the possibility of not being able to recognize it later when trying to find it in the long list of Services.
The UserName, Domain, and Password options allow you to make the service—and more importantly, the A-Shell sessions spawned by it—run with the specified user credentials, rather than the standard System user. Since the password is plain text, you may want to launch the service from another directory that is protected. You can also accomplish the same thing via the dialogs in the Services Manager.
After editing your ATSDSRV.INI file, the next step is to "install" the service, which you can do from the from an elevated command or PowerShell dialog with the following command:
c:\vm\miame\bin\atsdsrv -i
(Replace c:\vm\miame\bin with whatever directory you installed it in.)
After executing the above command, the new A-Shell Telnet Server service will appear in the Services Applet, where you can turn it on or off manually, as well as set it to start automatically on system bootup. In case of difficulty, see the following Service Installation Tips.
The install script will offer to install the service for you, in which case it performs the atsdsrv –i command for you. But you still need to go into the Services Applet to launch it the first time, and to set it to launch automatically thereafter.
Comments
You can use ATSDSRV.EXE to launch additional processes under the control of the one service, by adding additional parameter blocks to the ATSDSRV.INI named [Process1], [Process2], etc. Or, you can create copies of ATSDSRV.EXE and ATSDSRV.INI in other directories, with completely different service names. This might be an appropriate way of running background instances of A-Shell which act as "servers" in your application.
Warning: For most Windows Server environments, you'll need to use the -ntts option (see table here) to avoid sessions ending up with the same unique instance identifiers, resulting in clobbering each others' JOBTBL records. Check the ashlog.log for "zapped" if unsure whether this is happening; you can also use SYSTAT/C to see the if the identifiers are unique.