Services on Windows Platforms
- Creating a Service
- Starting the Service
- Stopping the Service
- Modifying a Service or Accessing Service Log Files
- Windows Services
- Removing a Service
Creating a Service
To create a service for an running in a Windows operating environment, perform the following steps:
- From the Start menu,
select Programs
SAS
SAS Deployment Manager.
If you are using Windows 8, navigate to the Apps screen. Under the SAS category, click the SAS Deployment Manager tile.
- The SAS Deployment Manager displays the Select SAS Deployment Manager Task page. Select the type of service that you want to create. Click Next.
- 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. - The SAS Deployment Manager selects a default 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.
- If you are defining a , you are prompted to specify the 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.
- If you chose a socket or , the Specify Administrator Password page appears. 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.
- The Summary page appears. It describes the service that is about to be created. If the information is correct, click Next to create the service.
- The In Progress page appears while SAS Deployment Manager creates the service. The Deployment Complete page appears 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.
- If you are creating a pool service, you must install the . You might also want to install the Load Manager if you have a socket service with more than one . See About the Load Manager for more information.
- 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.
- The must know about the new service before you can access it. Open the Application Broker configuration
file on your in a text editor and add a service definition block. Example service definitions
are provided in the template that is installed with the Application . 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.4\\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.4\\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 definition:
LaunchService service-name ServiceDescription "text-desc" ServiceAdmin "administrator-name" ServiceAdminMail "administrator-email-address@host" SasCommand ""\"C:\\Program Files\\SAS\\SASFoundation\\9.4\\sas.exe\"+ \"C:\\Program Files\\SAS\\IntrNet\\service-name\\appstart.sas\"+ -rsasuser -noterminal -noprint -nolog -SYSPARM "
- The following code is an example of a socket service definition:
Starting the Service
Socket
services must be started manually. From the Start menu,
select Programs
SAS
(or your SAS 9.4 program group)
IntrNet. Select the entry for the service you just created,
and then select Start Interactively.
If you are using Windows 8, navigate to the Apps screen. Under the SAS category, click the SAS IntrNet tile. In the Windows Explorer window, open the folder for the InterNet service that you just created. Double-click 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 . 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 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 Programs
SAS (or your SAS 9.4 program
group)
IntrNet.
Select the entry for the service you just created, and then select Service
Directory.
If you are using Windows 8, navigate to the Apps screen. Under the SAS category, click the SAS IntrNet tile. In the Windows Explorer window, open the folder for the InterNet service that you just created. Double-click Service Directory.
This service 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.
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
in to 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.4 System Requirements
documentation at support.sas.com/documentation/installcenter.
From the Start menu,
select Programs
SAS
(or your SAS 9.4 program group)
IntrNet. Select the entry for the service you just created,
and then select Install as Windows Service.
If you are using Windows 8, navigate to the Apps screen. Under the SAS category, click the SAS IntrNet tile. In the Windows Explorer window, open the folder for the InterNet service that you just created. Double-click 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:
- If the service is running, stop it.
- 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 Programs
SAS
(or your SAS 9.4 program group)
IntrNet. 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. - Find the service directory,
select Start Menu, and select
Programs
SAS
(or your SAS 9.4 program group)
IntrNet. Select the entry for the service, and then select Service
Directory. - Go up one level to the parent directory and delete the directory for the service that you want to remove.
- Remove the Start menu entry for the service. To do this, right-click the Start menu and select Explore All Users (or Explore on Windows 95/98).
- Use the Explorer window to find the Programs folder.
- Select SAS and then select IntrNet. Delete the service entry in this folder for the service that you want to remove.
If you are using Windows 8, follow these steps instead:
- If the service is running, stop it.
- If the service is a socket service and has been installed as a Windows service, uninstall it as a Windows service. Navigate to the Apps screen. Under the SAS category, click the SAS IntrNet tile. In the Windows Explorer window, open the folder for the InterNet service that you want to uninstall. Double-click Uninstall Windows Service. Perform this step even if you are not sure if this service is installed as a Windows service.
- In the service folder, double-click Service Directory.
- Go up one level to the parent directory and delete the directory for the service that you want to remove.
- Open the Shortcuts folder from the current folder. Delete the folder for the service that you are uninstalling. This folder contains the shortcuts for the service that you are uninstalling.