Laurent Schneider suggested one liner using AWK unix command - for my last script Extract_Text.sh... see here:
awk '/^CREATE UNIQUE INDEX/{print "-- Create unique index #"++x}/^CREATE TABLE/{print "-- Create table #"++y}/^CREATE (UNIQUE INDEXTABLE)/,/;/{print}' test.sql
/^CREATE (UNIQUE INDEXTABLE)/,/;/{print}: Searches for CREATE UNIQUE INDEX or CREATE TABLE and prints the lines till the first ";" encounters.
/^CREATE UNIQUE INDEX/{print "-- Create unique index #"++x}: Searches for pattern CREATE UNIQUE INDEX and prints "-- Create unique index # and the number of it's occurance".
/^CREATE TABLE/{print "-- Create table #"++y}: Searches for pattern CREATE TABLE and prints "-- Create unique index # and the number of it's occurance".
This is indeed a better and faster than the while read loop. Below is the modified script for download:
Extract_Text_Modified.sh
NOTE: After downloading this file, please REPLACE < ; with < and > ; with >
there is no space between < and ; or > and ;
* Thanks Laurent
Showing posts with label Shell Scripting in PeopleSoft. Show all posts
Showing posts with label Shell Scripting in PeopleSoft. Show all posts
Tuesday, August 26, 2008
Monday, August 25, 2008
UNIX - Extracting text between any Two Lines
I created a script that modifies an sql script in certain logical way. It extracts texts between certain logical lines and sends the output to a new file. You can download the shell script from here and try executing it with the attached test.sql as input. I created this script to alter PeopleSoft Generated AlterByRename sqls into simple CREATE statements.
Extract_Text.sh
usage: ./Extract_text.sh
NOTE: After downloading this file, please REPLACE
< ; with <
> ; with >
There is no space between < and ; or > and ; (I've mentained the space because of issue with blogspot)
test.sql
Extract_Text.sh
usage: ./Extract_text.sh
NOTE: After downloading this file, please REPLACE
< ; with <
> ; with >
There is no space between < and ; or > and ; (I've mentained the space because of issue with blogspot)
test.sql
Wednesday, April 30, 2008
Monitoring Scripts
Here are Shell Scripts to monitor/start/stop PeopleSoft Application Server & Process Scheduler status:
Application Server:
appsrv-status.sh
parameter file
Process Scheduler:
prcs-status.sh
parameter file
Process Scheduler Start-Stop:
prcs-start-stop.sh
parameter file
Application Server:
appsrv-status.sh
parameter file
Process Scheduler:
prcs-status.sh
parameter file
Process Scheduler Start-Stop:
prcs-start-stop.sh
parameter file
Wednesday, April 9, 2008
App Server Monitoring Script
Here I've created a shell script which can show you the status of large number of Application Server domains. Thought of, might be useful for some guys who are looking for the same kind of stuff...
we have two files here
1) param_list.txt -> list of app server domains
2) health.sh -> shell script that checks for the status of the app server domain
# Filename: param_list.txt
# Parameter List file
# Contains the list of environments
DOMAIN1
DOMAIN2
DOMAIN3
DOMAIN4
DOMAIN5
DOMAIN6
DOMAIN7
DOMAIN8
# Filename: health.sh
# Usage: ./health
# !/bin/sh
ENV_COUNTER=0
DATE=`date '+%Y%M%d_%H_%M_%S'`
OUTPUT_FILE='MONITOR_'$DATE
echo "*** Application Server Status as of `date`***" >> $OUTPUT_FILE
echo >> $OUTPUT_FILE
echo >> $OUTPUT_FILE
#while [ $ENV_COUNTER -le 9 ]
#do
for ENV in `cat param_list.txt`
do
TUXCONFIG=$PS_HOME/appserv/$ENV/PSTUXCFG; export TUXCONFIG
TUX_OUT_FILE=$ENV'_TUXOUT'
rm $TUX_OUT_FILE
echo pq | tmadmin -r > $TUX_OUT_FILE 2>&1
echo "*********************************************************" >> $OUTPUT_FILE
echo "*** Status Report for Application Server: $ENV ***" >> $OUTPUT_FILE
echo "**********************************************************" >> $OUTPUT_FILE
echo >> $OUTPUT_FILE
echo pq | tmadmin -r >> $OUTPUT_FILE 2>&1
#echo pclt | tmadmin -r >> $OUTPUT_FILE 2>&1
egrep "No bulletin board exists|ERROR" ${TUX_OUT_FILE} >/dev/null 2>&1
if test $? = 0
then
echo "App Server $ENV Status: DOWN"
echo >> $OUTPUT_FILE
echo "Application Server Status: DOWN" >> $OUTPUT_FILE
else
echo "App Server $ENV Status: UP"
echo >> $OUTPUT_FILE
echo "Application Server Status: UP" >> $OUTPUT_FILE
fi
echo "************************************************************" >> $OUTPUT_FILE
echo >> $OUTPUT_FILE
echo >> $OUTPUT_FILE
done
echo "*** End of Report ***" >> $OUTPUT_FILE
I am still working on it to add some more options like alerts, load, business etc... I will update it once done...
Comments are most welcome...
Cheers!!!
we have two files here
1) param_list.txt -> list of app server domains
2) health.sh -> shell script that checks for the status of the app server domain
# Filename: param_list.txt
# Parameter List file
# Contains the list of environments
DOMAIN1
DOMAIN2
DOMAIN3
DOMAIN4
DOMAIN5
DOMAIN6
DOMAIN7
DOMAIN8
# Filename: health.sh
# Usage: ./health
# !/bin/sh
ENV_COUNTER=0
DATE=`date '+%Y%M%d_%H_%M_%S'`
OUTPUT_FILE='MONITOR_'$DATE
echo "*** Application Server Status as of `date`***" >> $OUTPUT_FILE
echo >> $OUTPUT_FILE
echo >> $OUTPUT_FILE
#while [ $ENV_COUNTER -le 9 ]
#do
for ENV in `cat param_list.txt`
do
TUXCONFIG=$PS_HOME/appserv/$ENV/PSTUXCFG; export TUXCONFIG
TUX_OUT_FILE=$ENV'_TUXOUT'
rm $TUX_OUT_FILE
echo pq | tmadmin -r > $TUX_OUT_FILE 2>&1
echo "*********************************************************" >> $OUTPUT_FILE
echo "*** Status Report for Application Server: $ENV ***" >> $OUTPUT_FILE
echo "**********************************************************" >> $OUTPUT_FILE
echo >> $OUTPUT_FILE
echo pq | tmadmin -r >> $OUTPUT_FILE 2>&1
#echo pclt | tmadmin -r >> $OUTPUT_FILE 2>&1
egrep "No bulletin board exists|ERROR" ${TUX_OUT_FILE} >/dev/null 2>&1
if test $? = 0
then
echo "App Server $ENV Status: DOWN"
echo >> $OUTPUT_FILE
echo "Application Server Status: DOWN" >> $OUTPUT_FILE
else
echo "App Server $ENV Status: UP"
echo >> $OUTPUT_FILE
echo "Application Server Status: UP" >> $OUTPUT_FILE
fi
echo "************************************************************" >> $OUTPUT_FILE
echo >> $OUTPUT_FILE
echo >> $OUTPUT_FILE
done
echo "*** End of Report ***" >> $OUTPUT_FILE
I am still working on it to add some more options like alerts, load, business etc... I will update it once done...
Comments are most welcome...
Cheers!!!
Subscribe to:
Posts (Atom)
OCI - Attach Block Volume to Windows VM
Tip: Although creating and attaching Block Storage to a Windows VM is pretty straightforward (OCI documentation is pretty good for that), th...
-
Download this document - ( .doc ) or ( .pdf ) Change Assistant Introduction Change Assistant (CA) was first released in PeopleTools 8.44. C...
-
PeopleSoft Compare Reports: The compare reports are critical tools for the Fit/Gap analysis and determining the effort to re-apply/re-d...
-
In order to avoid various process scheduler related issues, three Process Scheduler tables PSPRCSRQST, PSPRCSQUE and PSPRCSPARMS must be in ...