27.12.2013 Views

SAS® Integration Technologies: Administrator's Guide (LDAP Version)

SAS® Integration Technologies: Administrator's Guide (LDAP Version)

SAS® Integration Technologies: Administrator's Guide (LDAP Version)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Initializing UNIX Environment Variables for SAS<br />

Workspace Servers<br />

In UNIX environments, many third−party databases require access information such as the default server address to be<br />

set as environment variables. To make these environment variables available to a SAS Workspace Server, you must<br />

create the workspace using a wrapper script that defines the variables before invoking SAS.<br />

The following code is an example script.<br />

#!/bin/ksh −p<br />

# Purpose: Runs database setup scripts before invoking SAS.<br />

# Called by objspawn.<br />

# Restore quotation marks around arguments that have multiple tokens.<br />

function quoteme { #arg<br />

if [[ $# −gt 1 ]]; then<br />

quoteme="\"$*\""<br />

else<br />

quoteme=$1<br />

fi<br />

}<br />

echo $quoteme<br />

# Run database setup scripts or set required environment<br />

# variables here.<br />

<br />

# Reconstruct and execute the original SAS command.<br />

cmd=''<br />

for arg in "$@" ; do<br />

tmp="$(quoteme $arg)";<br />

cmd="$cmd $tmp"<br />

done<br />

eval exec $cmd<br />

To use this script:<br />

1. Add your export statements or script calls and save the file as objspawn.setup in a location where all<br />

users have read and execute permissions.<br />

2. Set the execute bits for the file. You can do this using the following command:<br />

chmod 755 objspawn.setup<br />

3. Add objspawn.setup to the start of your sas command in the server definition. For example:<br />

objspawn.setup sas<br />

Initializing UNIX Environment Variables for SAS Workspace Servers 202

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!