====== PeopleSoft RC Scripts ====== ===== Actual Start/Stop Script ===== #!/usr/bin/ksh logger() { echo "$1" >> $RCLOG } init_log() { logger "***************************************************************" logger "** STARTING NEW INSTANCE of RC SCRIPT **" logger "***************************************************************" } set_environment() { export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/ccs/bin:/usr/ucb:. unset IS_PS_PLT unset PSJLIBPATH unset PSLIBPATH unset CLASSPATH unset ORACLE_SID unset LD_LIBRARY_PATH unset PS_HOME if [[ ! -f $PS/psconfig.sh ]] ; then return 1 else . $PS/psconfig.sh return 0 fi } clean_server() { case "$TYPE" in 'apps') logger "\n*Cleaning up Application Server directories" logger "*rm -Rf $PS_HOME/appserv/$DB/Archive/psappsrv_*" cd $PS_HOME/appserv/$DB/Archive && rm -Rf psappsrv_* logger "*rm -Rf $PS_HOME/appserv/$DB/CACHE/*" cd $PS_HOME/appserv/$DB/CACHE && rm -Rf * logger "*rm -Rf stdout stderr core ULOG*" cd $PS_HOME/appserv/$DB && rm -Rf core stdout stderr ULOG* cd $PS_HOME/appserv && rm -Rf core stdout stderr ULOG* logger "Done." ;; 'prcs') logger "\n*cleaning up Process Scheduler directories" logger "*rm -Rf $PS_HOME/Archive/psprcs_*" cd $PS_HOME/appserv/prcs/$DB/Archive && rm -Rf psprcs_* logger "*rm -Rf $PS_HOME/CACHE/*" cd $PS_HOME/appserv/prcs/$DB/CACHE && rm -Rf * logger "*rm -f core stdout stderr ULOG*" cd $PS_HOME/appserv/prcs/$DB && rm -f core stdout stderr ULOG* logger "Done." ;; 'pia') logger "\n*cleaning up PIA directories" logger "*rm -Rf $PS_HOME/webserv/$WEB/applications/peoplesoft/PORTAL/$WEB/cache/*" cd $PS_HOME/webserv/$WEB/applications/peoplesoft/PORTAL/$WEB/cache && rm -Rf * ;; esac } action() { DB=$1; PS=$2; TYPE=$3; YN=$4; ACT=$5 if [[ "$ACT" = "startup" && "$TYPE" = "prcs" ]] ; then C="-p start" fi if [[ "$ACT" = "shutdown" && "$TYPE" = "prcs" ]] ; then C="-p kill" fi if [[ "$ACT" = "startup" && "$TYPE" = "apps" ]] ; then C="-c boot" fi if [[ "$ACT" = "shutdown" && "$TYPE" = "apps" ]] ; then C="-c shutdown!" fi if [[ "$ACT" = "startup" && "$TYPE" = "pia" ]] ; then C="./startPIA.sh" fi if [[ "$ACT" = "shutdown" && "$TYPE" = "pia" ]] ; then C="./stopPIA.sh" fi logger "=========================================================================" echo `date` >> $RCLOG set_environment if [[ $? = 0 ]] ; then logger "*$DB $ACT $TYPE" echo "*$DB $ACT $TYPE" logger "*source $PS/psconfig.sh" if [[ "$TYPE" = "pia" ]] ; then WEB=`echo $DB|tr '[A-Z]' '[a-z]'` logger "*cd $PS_HOME/webserv/$WEB && $C" cd $PS_HOME/webserv/$WEB && ./$C >> $RCLOG 2>&1 cd $RCDIR logger "\nDone." else logger "*cd $PS_HOME/appserv && ./psadmin $C -d $DB" cd $PS_HOME/appserv && ./psadmin $C -d $DB >> $RCLOG 2>&1 cd $RCDIR logger "\nDone." fi if [[ "$ACT" = "shutdown" ]] ; then clean_server fi else logger "!$PS/psconfig.sh does not exist." logger "!no action taken for this environment." fi } #main() RCDIR=/opt/psoft/startup PSOFTTAB=$RCDIR/rctab RCLOG=$RCDIR/rclog AWK=/usr/bin/awk ACTIVE_ENVS=`cat $PSOFTTAB |grep -v \#|$AWK -F\: 'NF == 4 { if ($4 == "Y") printf("%s ",$1);}'` init_log for DB in $ACTIVE_ENVS; do PARM_LIST=`cat $PSOFTTAB|grep $DB|awk -F\: '{printf("%s %s %s %s",$1,$2,$3,$4)}'` case "$1" in 'start') action $PARM_LIST startup ;; 'stop') action $PARM_LIST shutdown ;; *) echo "\nStart PeopleSoft Services\nThis script must be run as 'psoft'.\nUsage: $0 (start|stop)\n" exit 1 ;; esac done exit 0 ===== psofttab configuration script ===== ################################################################ # psofttab ################################################################ # Configuration file for starting and stopping # PeopleSoft Process Schedulers and Application servers # used by the "rc" shell script in this directory # # format: DATABASE:PS_HOME:apps|prcs:Y|N # example: HRDMO:/opt/psoft/hcm88/hrdmo:apps|Y -- start HRDMO appserver # example: HRDMO:/opt/psoft/hcm88/hrdmo:apps|N -- don't start HRDMO appserver # example: FNDMO:/opt/psoft/fscm84/fndmo:prcs|Y -- start FNDMO scheduler # example: FNDMO:/opt/psoft/fscm84/fndmo:prcs|N -- don't start FNDMO scheduler ################################################################ TPSHRPER:/opt/psoft/hcm88/tpshrspd:prcs:Y TPSFNSUP:/opt/psoft/fscm84/tpsfnsup:prcs:Y DPSHRDV1:/opt/psoft/hcm88/dpshrdv1:apps:Y TPSFNTRN:/opt/psoft/fscm84/tpsfntrn:prcs:N DPSHRDPS:/opt/psoft/hcm88/dpshrdps:apps:Y QPSHRQPS:/opt/psoft/hcm88/qpshrqps:apps:N ===== clean logs script ===== #!/usr/bin/ksh cleandir() { DB=$1; PS=$2; TYPE=$3; YN=$4 DAYS=$5 echo "*************************************************************" echo "* Cleaning Log files older than $DAYS for $DB" echo "*************************************************************" if [[ "$TYPE" = "prcs" ]] ; then echo "cleaning $PS/appserv/prcs/$DB/LOGS:" LOC=$PS/appserv/prcs/$DB/LOGS cd $LOC && find . -depth -mtime +$DAYS -name "APPSRV_*.LOG" -exec rm -Rf {} \; cd $LOC && find . -depth -mtime +$DAYS -name "AESRV_*.LOG" -exec rm -Rf {} \; cd $LOC && find . -depth -mtime +$DAYS -name "MONITORSRV_*.LOG" -exec rm -Rf {} \; cd $LOC && find . -depth -mtime +$DAYS -name "DSTAGNT_*.LOG" -exec rm -Rf {} \; cd $LOC && find . -depth -mtime +$DAYS -name "PSAE*" -exec rm -Rf {} \; cd $LOC && find . -depth -mtime +$DAYS -name "SCHDLR_*.LOG" -exec rm -Rf {} \; cd $LOC && find . -depth -mtime +$DAYS -name "TUXLOG*" -exec rm -Rf {} \; cd $LOC && find . -depth -mtime +$DAYS -name "MSTRSCHDLR_*" -exec rm -Rf {} \; cd $LOC && find . -depth -mtime +$DAYS -name "*.tracesql" -exec rm -Rf {} \; echo "cleaning $PS/appserv/prcs/$DB/log_output:" LOC=$PS/appserv/prcs/$DB/log_output cd $LOC && find . -depth -mtime +$DAYS -name "delete*.txt" -exec rm -Rf {} \; cd $LOC && find . -depth -mtime +$DAYS -name "CBL*" -exec rm -Rf {} \; cd $LOC && find . -depth -mtime +$DAYS -name "SQR*" -exec rm -Rf {} \; cd $LOC && find . -depth -mtime +$DAYS -name "AE*" -exec rm -Rf {} \; cd $LOC && echo "cleaning $PS/appserv/prcs/$DB:" LOC=$PS/appserv/prcs/$DB cd $LOC && find . -depth -mtime +$DAYS -name "ULOG*" -exec rm -Rf {} \; cd $LOC && find . -depth -mtime +$DAYS -name "core" -exec rm -Rf {} \; fi if [[ "$TYPE" = "apps" ]] ; then echo "cleaning $PS/appserv/$DB/LOGS" LOC=$PS/appserv/$DB/LOGS cd $LOC && find . -depth -mtime +$DAYS -name "APPSRV_*" -exec rm -Rf {} \; cd $LOC && find . -depth -mtime +$DAYS -name "PSAPPSRV*" -exec rm -Rf {} \; cd $LOC && find . -depth -mtime +$DAYS -name "PSREN*" -exec rm -Rf {} \; cd $LOC && find . -depth -mtime +$DAYS -name "TUXLOG*" -exec rm -Rf {} \; cd $LOC && find . -depth -mtime +$DAYS -name "*.tracesql" -exec rm -Rf {} \; cd $LOC && find . -depth -mtime +$DAYS -name "access.log.*" -exec rm -Rf {} \; echo "cleaning $PS/appserv" LOC=$PS/appserv cd $LOC && find . -depth -mtime +$DAYS -name "ULOG*" -exec rm -Rf {} \; cd $LOC && find . -depth -mtime +$DAYS -name "core" -exec rm -Rf {} \; fi if [[ "$TYPE" = "pia" ]] ; then echo "PIA logs not cleaned via this script." fi echo "\nDone.\n" } #main() RCDIR=/opt/psoft/startup PSOFTTAB=$RCDIR/rctab RCLOG=$RCDIR/rclog AWK=/usr/bin/awk MORE_THAN=7 ACTIVE_ENVS=`cat $PSOFTTAB |grep -v \#|$AWK -F\: 'NF == 4 { if ($4 == "Y") printf("%s ",$1);}'` for DB in $ACTIVE_ENVS; do PARM_LIST=`cat $PSOFTTAB|grep $DB|awk -F\: '{printf("%s %s %s %s",$1,$2,$3,$4)}'` cleandir $PARM_LIST $MORE_THAN done exit 0