We’re smarter together. Learn from this collection of community knowledge and add your expertise.

Automate the Startup of the SAS Deployment Agent on Linux

by SAS Employee GerryNelson on ‎04-15-2016 01:37 PM (465 Views)

The dictionary defines an agent as "a person or thing that takes an active role or produces a specified effect". The SAS Deployment Agent is a SAS agent that, among other things, supports configuration operations associated with multi-machine mid-tier topologies and middle-tier clustering, and facilitates synchronizing backup and restore operations for server and middle-tier machines.

 

The agent is not going to produce its "specified effect" if it is not running. If the Backup and Recovery tool attempts an automated backup, and the deployment agent is not running on each server that will be backed up, an error will occur and the backup will fail.

 

In a Windows environment the SAS Deployment Agent is installed as a windows service and starts automatically when a machine starts. Until recently that capability has not been available in UNIX environments, now with the release of SAS 9.4 M3, it is.

 

To implement this capability in UNIX you use the operating system specific instructions within the script provided. The script is located at <SASHome>/SASDeploymentAgent/9.4/sas.deployd The process is also documented in the SAS® Deployment Wizard and SAS® Deployment Manager 9.4: User’s Guide. This process is very similar to the one used to automate sas.servers (the script which starts most other SAS servers) on LINUX. To automate the startup of the deployment agent when the machine starts there are three steps.

 

Firstly, as the root user, copy the script to /etc/init.d and make sure the permissions are correct. On LINUX the /etc/init.d directory contains all of the command files that that start and stop the services on the machine.

 

cp SASHome/SASDeploymentAgent/9.4/sas.deployd /etc/init.d

 

chown root:root /etc/init.d/sas.deployd

 

chmod 0755 /etc/init.d/sas.deployd

 

Secondly, install this script as bootable. As the root user execute the command:

 

/sbin/chkconfig --add sas.deployd

 

The chkconfig command is used to setup, view, or change services that are configured to start automatically during the system startup. The --add tells chkconfig to add this script as a boot service to the system with the service name sas.deployd.

 

Finally, configure when the boot service will run. As the root user execute the command:

 

/sbin/chkconfig --level 35 sas.deployd on

 

The --level 35 with the on parameter tells chkconfig to arrange for this service to start at run levels 3 and 5.

 

This script will run on machine startup upon entering runlevel 3 or 5. What does that mean? Run levels represent the mode in which your LINUX computer is operating. Comparing it to Windows, a run level similar to the mode you can boot a machine too, for example "Safe Mode", "Safe Mode with Networking", "Command Prompt" etc. Linux run levels are mutually exclusive, you can only be in one at a time. A configuration file setting stores the default runlevel for a machine.

 

So we added the deployment agent to runlevel 3, which is multi-user with network support, and runevel 5 which is multi-user with network support plus X11 display manager support. The result is that if the machine boots to runlevel 3 or runlevel 5 the server will be started automatically. As a user you won’t normally be aware of run levels, but the multi-user run levels make available the services you would expect to find when using a Linux system — printing, networking, and other high-level services

 

It’s important to realize LINUX doesn't move through the run levels on boot. A machine is configured to boot to a specific runlevel, when it does it executes that startup scripts for that runlevel, it doesn’t execute the scripts associated with lower run levels. If this is still not way too geeky for you, you can check the current runlevel of a LINUX machine with the (you guessed it) runlevel command.

 

1_deployment_agent_start.png

 

To simplify it, we have added a deploymnt agent services and configured it to run when LINUX boots into the two most typical modes for general usage, multi-user with network support(3) and multi-user with network support plus X11 (5). If you want to read in great detail about LINUX server startup and run levels I recommend this article. Did it work? The two chkconfig commands used to setup the boot service provide no visible feedback to the command line when they execute successfully. To verify that the installation succeeded, invoke:

 

/sbin/chkconfig --list sas.deployd

 

2_deployment_agent_start2.png

 

The output shows the two runlevels where the service is turned on (3 and5).

 

To test that the service works you can run it from the command prompt. In addition to automating the startup of the deployment agent on LINUX you can now start, stop and check the status of the agent from the command-line by entering:

 

service sas.deployd start|stop|status

 

3_deployment_agent_start3.png

 

With the deployment agent starting automatically on server boot, activities which use it like the Deployment Backup and Recovery tool will run successfully. 

Your turn
Sign In!

Want to write an article? Sign in with your profile.