Skip to content

Instantly share code, notes, and snippets.

@mtcoffee
Last active August 27, 2016 17:56
Show Gist options
  • Save mtcoffee/295bcb29f83084b97e3fd1308f6da194 to your computer and use it in GitHub Desktop.
Save mtcoffee/295bcb29f83084b97e3fd1308f6da194 to your computer and use it in GitHub Desktop.
CreatePRCSServerDomain
#!/bin/bash
#This script will quickly create a new Linux/Unix PeopleSoft process scheduler domain and perform some checks
#IMPORT INFORMATION
#1. YOU MUST SET THE PS_HOME PS_CFG_HOME PS_APP_HOME and PS_CUST_HOME VARIABLES BEFORE RUNNING THIS SCRIPT
#2. YOU MUST ALSO HAVE A CUSTOM TEMPLATE SAVED UNDER $PS_HOME/appserv/prcs/unix_custom.cfx
# THE TEMPLATE CAN BE CREATED BY COPYING THE DELIVERED TEMPLATE $PS_HOME/appserv/prcs/unix.cfx
#3. THE SECTION AFTER "POST DOMAIN CHECKS" IS OPTIONAL AND CAN BE EASILY CUSTOMIZED OR EXCLUDED.
#Known to work with PeopleTools 8.54 and 8.55.
############################
##variables required for creation of prcs domain
ENVIRONMENT=dbname
NEW_DOMAIN=mydomain
DBPASS=peop1e
DBUSER=people
OPRIDPASS=PS
OPRIDUSER=PS
PRCSSERVER=PSUNX
DOM_CONN_PWD=_____
#Check if variables are set and point to valid paths
PATHSTOCHECK=(PS_HOME PS_CFG_HOME PS_APP_HOME PS_CUST_HOME)
for i in ${PATHSTOCHECK[*]}; do
if [ -n "${!i}" ] && [ -d "${!i}" ]; then
echo "$i path ${!i} does exist"
else
echo "########################################"
echo "$i path ${!i} does not exist or variable is not set This needs to be corrected first."; exit 1
fi
done;
#Check for custom cfx file
if test -f "$PS_HOME/appserv/prcs/unix_custom.cfx"; then
echo "$PS_HOME/appserv/prcs/unix_custom.cfx found and will be used as template for the new domain"
else
echo "########################################"
echo "$PS_HOME/appserv/prcs/unix_custom.cfx not found. This needs to be corrected first."; exit 1
fi
#Confirm domain name not already in use
if test ! -d "$PS_CFG_HOME/appserv/prcs/$NEW_DOMAIN"; then
echo "$PS_CFG_HOME/appserv/prcs/$NEW_DOMAIN not already in use and will be the path/name for the new domain"
else
echo "########################################"
echo "$PS_CFG_HOME/appserv/prcs/$NEW_DOMAIN already exists. Either rename the existing domain or change the name to be used."; exit 1
fi
#Show version of PeopleTools Home that domain will be created for.
echo "########################################"
grep -i "productversion" "$PS_HOME/peopletools.properties"
echo "The new domain will be created for PeopleTools version shown above".
echo "In 10 seconds the create will start. Type CTRL-C to stop this job"
sleep 10s
echo ""
echo "CREATING NEW PROCESS SCHEDULER DOMAIN $NEW_DOMAIN FOR DATABASE $ENVIRONMENT"
#Example of command http://docs.oracle.com/cd/E58500_01/pt854pbh1/eng/pt/tsvt/task_UsingthePSADMINCommand-LineInterface-c07e70.html
#psadmin -p create -d domain -t template -ps ps_set (settings list->) DBNAME,DBTYPE,PRCSSERVER,OPR_ID,OPR_PSWD,DB_CNCT_ID,DB_CNCT_PSWD,SERVER_NAME,LOGOUT_DIR,SQRBIN,ADD_TO_PATH,DOM_CONN_PWD,{ENCRYPT|NOENCRYPT} [-env env_set] [-s silent] to create process_scheduler
psadmin -p create -d $NEW_DOMAIN -t unix_custom -ps $ENVIRONMENT,ORACLE,$PRCSSERVER,$OPRIDUSER,$OPRIDPASS,$DBUSER,$DBPASS,_____,%PS_SERVDIR%/log_output,%PS_HOME%/bin/sqr/%PS_DB%/bin,.,$DOM_CONN_PWD,ENCRYPT
#Reconfigure domain options and make the process a master and enable app engine server
echo ""
echo "########################################"
echo "CONFIGURING NEW PROCESS SCHEDULER DOMAIN $NEW_DOMAIN AS MASTER SCHEDULER AND ENABLING APPLICATION ENGINE SERVER PROCESS"
psadmin -p configure -d $NEW_DOMAIN -u {MSTRSRV}=Yes%{APPENG}=Yes%
##################POST DOMAIN CHECKS########################
#Checking configuration after the domain creation
echo ""
echo "########################################"
echo "NOW RUNNING POST DOMAIN CREATION CHECK"
#Checking cfg variables
cfg_variables=(
"DbFlags=8"
"PSSQR=%PS_CUST_HOME%/sqr:%PS_APP_HOME%/sqr:%PS_HOME%/sqr"
"Allow Dynamic Changes=Y"
#SMTPSender is modified to work with grep and wildcards
"SMTPSender=.*\mydomain.com"
)
for i in "${cfg_variables[@]}"; do
echo "Checking" $i
if grep -iq "$i" "$PS_CFG_HOME/appserv/prcs/$NEW_DOMAIN/psprcs.cfg" ; then
echo "CFG value $i is set as expected"
else
echo ""
echo "##################################"
echo "Domain has been created but CFG value $i needs fixing"
echo "##################################"
fi
done;
#Checking environment variables
env_variables=(
"COBPATH=%PS_CUST_HOME%/cblbin:%PS_APP_HOME%/cblbin:%PS_HOME%/cblbin"
)
for i in "${env_variables[@]}"; do
echo "Checking" $i
if grep -iq "$i" "$PS_CFG_HOME/appserv/prcs/$NEW_DOMAIN/psprcsrv.env" ; then
echo "Variable $i is set as expected"
else
echo ""
echo "##################################"
echo "Domain has been created but variable $i needs fixing"
echo "##################################"
fi
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment