"Sourcing" the DSEE paths & man page info into your working shell!

# source ./setenv.sh

You might see reference in my blog entries being published over the next few weeks for an "environment settings" script that I source within any new (bash) shell I start to manage 6.x directory services.

I present a complete discussion of the line above, later in this document.  Including the concept of "sourcing" the script, so it remains present in your shell after you call it from the command line as presented above.  The command "source" can be substituted by a lone period followed by a space and a path to the file to be sourced.

Why would I use this script?

The 6.x services are, by design, completely command line manageable.  The best way to get started/be prepared to work with a system where the DSCC web interface is centralized, or if it is ever not available to a system being deployed, you can install, set up, configure directory services, and attach new server installations to a remote DSCC installation all from the command line.  The name is like any other script name... what made sense at the time I set this up.

Note that the contents of the "setenv.sh" when sourced in my current shell, allow me to "add" the paths and man paths necessary for me to manage my DSEE install...  here is what I have in my file... adjust for your environmnet.  Note that you can add to this, review the DSEE 6/x  installation documentation section on "Environment Variables" at http://docs.sun.com/app/docs/doc/820-2761/install-envars?l=en&a=view

Sourcing a file

When you "source" a file, as opposed to executing it, it "appends" the environment modifications of the script to your current shell, as opposed to when you execute a script that sets its own environment, applying the settings to the run time of the script execution, and then discarding them as the script completes. Sourcing is handy if you need to manage software with varying env requirements (java_home, etc). When I SSH into my workstation on sun's network, I can jump into the DSEE (or DS) install of my choice and source the right setenv.sh script (in each versions installed path on my system). This works for "ZIP/Compressed Archive" distributions of the DS, for JES (Native PKG) installs, you can only do 1 JES install per OS install (so use whole root non global zones or VM's to play with multiple versions of this native install on the same system)

 --- an example setenv.sh file starts below this line with the first # - do not set the execute bit for this file so it is not run as a sctipt. --

#!/bin/bash
## The following can be un-commented for setting default switch values, remove [] brackets in your edited values
## current values are hint s/examples.
## DIR_PROXY_HOST=[host.fqdn.recommended]
## DIR_PROXY_PORT=[proxy ldap port]
LDAP_ADMIN_PWF=[/opt/.pswd.txt]
## -- The following section lets you preset the -h and -p switch for your LDAP server host and port --
DIRSERV_HOST=test-ds.example.com
DIRSERV_PORT=1389
## The following is for the DSCC Registry or Administrative DS (ADS)
## set when using a non-default port for the registry
DSCC_PORT=4998
DSCC_HOST=test-adminhost.example.com
## The following 2 lines are for enabling GSSAPI auth on solaris/linux ODSEE servers - see admin guide.
#SASL_PATH=$DSEE_ROOT/dsee7/lib/private/sasl2
#KRB5_KTNAME=/opt/odsee-11gR1p1/inst/ds-test-gssapi-22389/config/solaris-test-lab.keytab
## un-comment the lines below to enable command line debugging output.
#export SLAPX_DEBUG_AREA=-1
#export SLAPX_DEBUG_LEVEL=-1
## select from the 2 path/export choices below based on if your using 6.x or 7.x/11.x ODSEE
##
PATH=$DSEE_ROOT/dsee7/bin:$DSEE_ROOT/dsee7/bin/64:$DSEE_ROOT/dsee7/dsrk/bin:$DSEE_ROOT/dsee7/bin/support_tools:$PATH
#PATH=$JAVA_BIN:$DSEE_ROOT/dsee6/cacao_2/usr/sbin:$DSEE_ROOT/ds6/bin/64:$DSEE_ROOT/ds6/bin:$DSEE_ROOT/dscc6/bin:$DSEE_ROOT/dsrk6/bin:$DSEE_ROOT/dsee6/bin:$DSEE_ROOT/dps6/bin/sparcv9:$DSEE_ROOT/dps6/bin:$PATH
## The following 2 lines setup man page access;
MANPATH=$MANPATH:$DSEE_ROOT/resources/man
MANSECT=$MANSECT:1:1m:4:5dsconf:5dpconf:5dssd:5dsat:5dsoc:5dssd:dscc
export LDAP_ADMIN_PWF DIRSERV_HOST DIRSERV_PORT DSCC_HOST DSCC_PORT MANPATH MANSECT
#export SASL_PATH KRB5_KTNAME PATH DIRSERV_HOST DIRSERV_PORT DSCC_PORT MANPATH MANSECT
#export PATH MANPATH MANSECT
# Set for ISW install/cli use only - 1.5x not compat with odsee - unset java home before managing DS with dsadm/dsconf
#JAVA_HOME=/usr/jdk/jdk1.5.0_29
#JAVA_BIN=$JAVA_HOME/bin
#export JAVA_HOME

---- end setenv.sh file content above this line

to properly "source" the file, you will

bash-3.00# . /opt/SUNWdsee/setenv.sh

or

bash-3.00# source /opt/SUNWdsee/setenv.sh

Note that there is nothing returned from the command line when you source a file, to see what is going on, you can check with the env command. First you log into a new bash shell and check your environment.

bash-3.00# env
MANPATH=:/resources/man
TERM=xterm
SHELL=/sbin/sh
SSH_CLIENT=###.###.###.### ##### 22
DSCC_PORT=4998
SSH_TTY=/dev/pts/1
DIRSERV_PORT=17389
USER=root
SUPPORT_HOME=/support
MANSECT=:1:1m:4:5dsconf:5dpconf:5dssd:5dsat:5dsoc:5dssd:dscc
PATH=/dsee7/bin:/dsee7/bin/64:/dsee7/dsrk/bin:/dsee7/bin/support_tools:/usr/sbin:/usr/bin:/opt/local/openssl/bin:/opt/csw/bin:/support/impi_rm/bin:/usr/ccs/bin:/support/mysql/bin:/usr/local/bin:/support/scripts:/support/install/OpenDS-1.2.0/bin
MAIL=/var/mail//root
PWD=/
TZ=US/Mountain
SHLVL=1
HOME=/
DIRSERV_HOST=test-ds.example.com
LOGNAME=root
SSH_CONNECTION=###.###.###.### ##### ###.###.###.### 22
DSCC_HOST=test-adminhost.example.com
LDAP_ADMIN_PWF=[/opt/.pswd.txt]
_=/usr/bin/env

Then you source your setenv.sh file like so

bash-3.00# . /opt/SUNWdsee/setenv.sh

That is a "period" "space" "path to and file name for your env script".  When you check your environment again (env command) you will see that it has been modified

bash-3.00# env
MANPATH=:/opt/SUNWdsee/dsee6/man
TERM=xterm
SHELL=/sbin/sh
SSH_CLIENT=10.100.101.254 50301 22
SSH_TTY=/dev/pts/2
DIRSERV_PORT=389
USER=root
MANSECT=:1:1m:4:5dsconf:5dpconf:5dssd:5dsat:dscc
PATH=/usr/sbin:/usr/bin:/opt/SUNWdsee/ds6/bin:/opt/SUNWdsee/dscc6/bin:/opt/SUNWdsee/dsee6/bin:/opt/SUNWdsee/dps6/bin/
MAIL=/var/mail//root
PWD=/
TZ=US/Mountain
SHLVL=1
HOME=/
DIRSERV_HOST=ds-zone-1.test.lab
LOGNAME=root
SSH_CONNECTION=10.100.101.254 50301 10.100.101.32 22
DISPLAY=localhost:10.0
_=/usr/bin/env
bash-3.00#
bash-3.00# which dsad
/opt/SUNWdsee/ds6/bin/dsadm 

At this point we can access all of the commands described in the install and administration documentation for the 6.x DSEE.  Again, for the ZIP distribution, you will end up using the install root you selected instead of the /opt/SUNWdsee used by the JES, you will have additional paths to map for the cacao installed with the ZIP distribution as well as DSRK.

Have fun!


Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Supporting DSEE and DS products... check out blogs.sun.com/dsee for more information on the DS product.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today