Services on Windows Platforms

Creating a Service

To create a service for an Application Server running in a Windows operating environment, perform the following steps:
  1. From the Start menu, select Programsthen selectSASthen selectSAS Deployment Manager.
  2. The SAS Deployment Manager displays the Select SAS Deployment Manager Task page. Select the type of service that you want to create. Click Next.
  3. Enter the name of the new service. (Remember that service names must begin with either a letter or an underscore and can contain letter, number, underscore, or hyphen characters.) The default value for this field is default. Create this as your first service because this is what is used when you run the samples. Click Next.
  4. The SAS Deployment Manager selects a default service root directory based on the location that you chose for user files when you installed SAS software. This default location is recommended for most users, although you can use the Browse button to select a different directory. Click Next.
  5. If you are defining a socket service, you are prompted to specify the TCP/IP port numbers or names for each Application Server that you want to define as part of this service. If you supply multiple numbers or names, use a space to separate each entry. You can also specify ranges of numbers. Click Next.
  6. If you chose a socket or pool service, the Specify Administrator Password page displays. If you want to protect this service with an administrator password, enter the password in the Password field and then verify it in the Confirm Password field. Click Next.
  7. The Summary page displays. It describes the service that is about to be created. If the information is correct, click Next to create the service.
  8. The In Progress page displays while SAS Deployment Manager creates the service. The Deployment Complete page displays when the task is finished. If the service is created correctly, there is a green check mark next to 1. SAS/IntrNet under Stage 1: Create Service-Type Service. If there was a problem, there is a yellow exclamation or red X. You can check the log in <SASHOME>\InstallMisc\InstallLogs.
  9. If you are creating a pool service, you must install the Application Load Manager. You might also want to install the Load Manager if you have a socket service with more than one server. See About the Load Manager for more information.
  10. If you are creating a pool service, you might need to install the SAS Spawner. The Spawner is not required if you configure the Application Load Manager to start the service directly. If you choose this method, the servers must all execute on the same system as the Load Manager and under the same user ID. Refer to the SAS/CONNECT documentation for installation instructions for the SAS Spawner.
  11. The Application Broker must know about the new service before you can access it. Open the Application Broker configuration file on your Web server in a text editor and add a service definition block. Example service definitions are provided in the template configuration file that is installed with the Application Broker. In addition, sample configuration text was generated by the configuration utility in a preceding step. The following examples also show service definitions.
    • The following code is an example of a socket service definition:
      # This service contains one server (port 5801) on yourserver.
      SocketService service-name
      ServiceDescription "text-desc"
      ServiceAdmin "administrator-name"
      ServiceAdminMail "administrator-email-address@host"
      Server yourserver
      Port 5801
    • The following code is an example of how to define a pool service that is started directly by the Load Manager:
      # Start up to 2 servers on the same node as the Load Manager. No
      # username/password or spawner is needed for this case. Servers
      # time out after 30 minutes.
      PoolService service-name
      ServiceDescription "text-desc"
      ServiceAdmin "administrator-name"
      ServiceAdminMail "administrator-email-address@host"
      ServiceLoadManager load-manager-host:port
      SasCommand ""\"C:\\Program Files\\SAS\\SASFoundation\\9.3\\sas.exe\"+
      \"C:\\Program Files\\SAS\\IntrNet\\service-name\\appstart.sas\"+
      -rsasuser -noterminal -noprint -nolog -SYSPARM "
      IdleTimeout 30
      Server yourserver
      Port 2
    • The following code is an example of how to define a pool service that is started by the SAS Spawner:
      # Start up to 5 servers on node yourserver using the spawner started
      # at port 7777. All servers are started with the specified
      # username/password. At least 1 server will not time out and
      # is kept running.
      PoolService service-name
      ServiceDescription "text-desc"
      ServiceAdmin "administrator-name"
      ServiceAdminMail "administrator-email-address@host"
      ServiceLoadManager load-manager-host:port
      SasCommand ""\"C:\\Program Files\\SAS\\SASFoundation\\9.3\\sas.exe\"+
      \"C:\\Program Files\\SAS\\IntrNet\\service-name\\appstart.sas\"+
      -rsasuser -noterminal -noprint -log /dev/null -SYSPARM"
      Server yourserver
      Port 6000-6004
      Username your-username
      Password your-password
      SpawnerPort 7777
      MinRun 1
    • The following code is an example of a launch service definition:
      LaunchService service-name
      ServiceDescription "text-desc"
      ServiceAdmin "administrator-name"
      ServiceAdminMail "administrator-email-address@host"
      SasCommand ""\"C:\\Program Files\\SAS\\SASFoundation\\9.3\\sas.exe\"+
      \"C:\\Program Files\\SAS\\IntrNet\\service-name\\appstart.sas\"+
      -rsasuser -noterminal -noprint -nolog -SYSPARM "

Starting the Service

Socket services must be started manually. From the Start menu, select Programsthen selectSAS (or your SAS 9.3 program group)then selectIntrNet. Select the entry for the service you just created, and then select Start Interactively.
Launch services are started automatically by the Application Broker. Pool services are started automatically by the Application Load Manager. See About the Load Manager for more information.
After a service is started, you can test it from a Web browser. The URL depends on the platform and path where your Application Broker is installed. For typical installations, use one of the following URLs to test (or ping) a service:
Windows
http://yourserver/scripts/broker.exe?_service=service-name&_program=ping
UNIX and z/OS
http://yourserver/cgi-bin/broker?_service=service-name&_program=ping
Specify your Web server name in place of yourserver and your service name in place of service-name. You might need to use a different URL path if you chose a different path when you installed the Application Broker. If the service is running, an HTML page is returned stating that the Application Server is functioning.

Stopping the Service

Socket or pool services can be stopped from a Web browser. The URL depends on the platform and path where your Application Broker is installed. For typical installations, use one of the following URLs to stop a service:
Windows
http://yourserver/scripts/broker.exe?_service=service-name&_program=stop
UNIX and z/OS
http://yourserver/cgi-bin/broker?_service=service-name&_program=stop
Specify your Web server name in place of yourserver and your service name in place of service-name. You might need to use a different URL path if you chose a different path when you installed the Application Broker.

Modifying a Service or Accessing Service Log Files

Service configuration and log files are kept in a service directory tree. The service root directory can be accessed from the Windows Start menu. From the Start menu, select Programsthen selectSAS (or your SAS 9.3 program group)  then selectIntrNet. Select the entry for the service you just created, and then select Service Directory. This directory contains an appstart.sas file with the SAS code used to start the Application Servers for this service. Other scripts and configuration files for this service are also located in this directory.
Log files are placed in the logs directory under the service root directory and are named <day>_<port>.log. (for example, Mon_5001.log or Tue_5001.log). By default, logs are kept for one week (six full days and one partial day) and then overwritten.
SAS 9 has implemented a set of % codes that can be used in the -log parameter. You must add a -logparm option to get the codes translated into the log. For example, adding the following options creates log files with unique log filenames:
-log 'C:\Program Files\Sas\IntrNet\service-name\logs\appsrv_%v.log'
-logparm rollover=auto
The ROLLOVER=AUTO option causes an automatic rollover of the log when the directives in the value of the LOG option change. This is particularly useful for generating log files for pool or launch services. This example creates log filenames such as appsrv_1.log, appsrv_2.log, and appsrv_3.log.
Note: You must use a full path to specify the log file because there is limited control over what path the Load Manager or Spawner uses as the current directory for each Application Server.
For more information, see the documentation on the LOGPARM= system option in SAS System Options: Reference.

Windows Services

Socket services can be installed as Windows services. Installing as a Windows service enables the service to run automatically whenever the Windows system is booted, even if a user is not logged into the system. As noted previously, you should install the SAS Service Configuration Utility before you create any service that is installed as a Windows service. Information about the SAS Service Configuration Utility is located in the SAS 9.3 System Requirements documentation at support.sas.com/documentation/installcenter.
From the Start menu, select Programsthen selectSAS (or your SAS 9.3 program group)then selectIntrNet. Select the entry for the service you just created, and then select Install as Windows Service. This step does not start the service. Once the service has been installed as a Windows service, each time the system reboots, the service is started automatically. You can manually start and stop the Windows service by using the Start Windows Service and Stop Windows Service menu selections. Note that you can still run this service interactively by using the Start Interactively menu selection but only if the Windows service has been stopped.
A Windows service can also be uninstalled from the Uninstall Windows Service menu selection. This only uninstalls the Windows service. The SAS/IntrNet service remains and can still be run interactively.
The Services icon in the Windows Control Panel enables you to see the current status of all Windows services. Each SAS/IntrNet service display name begins with SAS App Server. Note that a separate Windows service is created for each server in a multiple-server socket service. Individual servers can be started and stopped from the Services Control Panel. You can use the Start menu selections to start or stop all servers in the service.

Removing a Service

You can remove a service by deleting the service directory and removing the associated Start menu entry. Follow these steps:
  1. If the service is running, stop it.
  2. If the service is a socket service and has been installed as a Windows service, uninstall it as a Windows service. From the Start menu, select Programsthen selectSAS (or your SAS 9.3 program group) then selectIntrNet. Select the entry for the service, and then select Uninstall as a Windows Service. Perform this step even if you are not sure if this service is installed as a Windows service.
  3. Find the service directory, select Start Menu, and select then selectProgramsthen selectSAS (or your SAS 9.3 program group)then selectIntrNet. Select the entry for the service, and then select Service Directory.
  4. Go up one level to the parent directory and delete the directory for the service that you want to remove.
  5. Remove the Start menu entry for the service. To do this, right-click on the Start menu and select Explore All Users (or Explore on Windows 95/98).
  6. Use the Explorer window to find the Programs folder.
  7. Select SAS and then select IntrNet. Delete the service entry in this folder for the service that you want to remove.