# 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 JAVA_HOME=/usr/jdk/jdk1.6.0_11 ## These allow you to define the default DS instance to be managed, ## as opposed to using the -h(ost) and -p(ort) command line switches #DIR_PROXY_HOST=ds-zone-1.test.lab #DIR_PROXY_PORT=38963 DIRSERV_HOST=ds-zone-1.test.lab DIRSERV_PORT=389 ## to be able to get to the man pages... MANPATH=$MANPATH:/opt/SUNWdsee/dsee6/man MANSECT=$MANSECT:1:1m:4:5dsconf:5dpconf:5dssd:5dsat:dscc ## and finally appending the installed DSEE's command paths in your path environment. PATH=$PATH:/opt/SUNWdsee/ds6/bin:/opt/SUNWdsee/dscc6/bin:/opt/SUNWdsee/dsee6/bin:/opt/SUNWdsee/dps6/bin/ # un-comment the lines below to enable command line debugging output. #export SLAPX_DEBUG_AREA=-1 #export SLAPX_DEBUG_LEVEL=-1
---- 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 TERM=xterm SHELL=/sbin/sh SSH_CLIENT=10.100.101.254 50301 22 SSH_TTY=/dev/pts/2 USER=root PATH=/usr/sbin:/usr/bin MAIL=/var/mail//root PWD=/ TZ=US/Mountain SHLVL=1 HOME=/ LOGNAME=root SSH_CONNECTION=10.100.101.254 50301 10.100.101.32 22 DISPLAY=localhost:10.0 _=/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!