Services on UNIX Platforms
Creating a Service
To create a service for an running on a UNIX platform, perform the following steps:
- From a system prompt,
submit the following command:
<SASHOME>/SASDeploymentManager/9.4/sasdm.shwhere <SASHOME> is the path to the SAS home directory.
- The Choose Language window appears. Select a language and click OK.
- The SAS Deployment Manager window appears. Under SAS/IntrNet Service Tasks, select the type of service that you want to create and click Next.
- The Specify Service Name page appears. Click Next to accept the default value, which names the service default. To create a service other than default, enter the service name, and then click Next.
- The Specify Service Directory page appears. This page prompts you for the name of the service directory where all of the service control files should be stored. Click Next to accept the suggested value, or enter the desired directory name and then 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 a , 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 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, then 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. The Spawner is not required if you choose to use the UNIX daemon to start the servers. Refer to the SAS/CONNECT documentation for installation instructions for the SAS Spawner.
- The must know about this service so that you can access it. Open the Application Broker configuration
file on your in an editor and add a service definition block. Example service definitions are
found in the template installed with the Application . 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 "brief-text-desc" ServiceDescription "text-desc" ServiceAdmin "administrator-name" ServiceAdminMail "administrator-email-address@host" Server yourserver Port 5801 - The following code is an example of a definition:
LaunchService service-name "brief-text-desc" ServiceDescription "text-desc" ServiceAdmin "administrator-name" ServiceAdminMail "administrator-email-address@host" SasCommand "/your/bin/sas+ /your/intrnet/service-name/appstart.sas+ -rsasuser -noterminal -noprint -nolog -SYSPARM" - 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 "/your/bin/sas+ /your/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 "/your/bin/sas+ /your/intrnet/service-name/appstart.sas+ -rsasuser -noterminal -noprint -nolog -SYSPARM" Server yourserver Port 6000-6004 Username your-username Password your-password SpawnerPort 7777 MinRun 1
- The following code is an example of a socket service definition:
Starting the Service
Socket services must be started with the start.sh script created by the configuration utility. To start the service, change to the created by the utility. Then submit the following command:
./start.sh
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.
Once 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:
- UNIX and z/OS:
-
http://yourserver/cgi-bin/broker?_service=service-name&_program=ping - Windows:
-
http://yourserver/scripts/broker.exe?_service=service-name&_program=ping
You must 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:
- UNIX and z/OS:
-
http://yourserver/cgi-bin/broker?_service=service-name&_program=stop - Windows:
-
http://yourserver/scripts/broker.exe?_service=service-name&_program=stop
You must 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.
You can also stop services on UNIX hosts by using the inetstop.sas macro that is installed in sasautos. Define the macro and then run it with the following command:
%inetstop(brokerurl, service-name, adminpw);
You must specify the Application Broker URL that you are using in place of brokerurl and your service name in place of service-name. If you specified an administrator password for the service, then specify the password in place of adminpw.
Service Log Files
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 '/full-service-root-path/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.
Removing a Service
A service can be removed by deleting the service root directory and its contents. Any active servers must be stopped before deleting this directory.