23 Jan 2014

Grep command with Examples

Grep :
grep command is one of the most frequently used UNIX command stands for "Global Regular Expression Print"  like  find, chmod or tar command in Unix. grep command in Unix operating system e.g. Linux, Solaris, BSD, Ubuntu or IBM AIX is used to search files with matching patterns, by using grep command in Unix you can search a file which contains a particular word or particular pattern.

grep -v you can list down all files which doesn't contains a word i.e. excluding files which matches a pattern
grep -c will print count of matching pattern in a file etc. One of the popular example of  grep command is to find empty files and directories in Unix.

grep command in Unix Example 1: 
Finding relevant word and exclusion of  irrelevant word. Most of the time I look for Exception and Errors in log files and some time I know certain Exception I can ignore so I use grep -v option to exclude those Exceptions
grep Exception logfile.txt | grep -v ERROR

This grep command example will search for word "Exception" in logfile.txt and print them but since we have piped out of first grep command to second grep command which will exclude all lines which match world "ERROR".  To make this grep example more concrete let's see another example, here we have a file which contains three lines  as shown below :
$ cat example.txt
UNIX operating system
UNIX and Linux operating system
Linux operation system

Now we want to search all lines in file example.txt which contains word UNIX but same time doesn't contain world Linux.
 
$ grep UNIX example.txt
UNIX operating system
UNIX and Linux operating system

Now to exclude all lines which contains Linux we will apply another grep command in this output with option -v to exclude matching word as shown in below grep command :

$ grep UNIX example.txt  | grep -v Linux
UNIX operating system

Grep command Example 2: 
If you want to count of a particular word in log file you can use grep -c option to count the word. Below example of command will print how many times word "Error" has appeared in logfile.txt.

grep -c "Error" logfile.txt

If we apply this grep command on our example file to find how many lines contains  word e.g. UNIX has occurred in the file :
$ grep -c UNIX example.txt
2

Difference b/w find and grep commands:
Find command is used to search for a file with a specific file name in a set of files.
Syntax: find .-name "fileE" -print
Ex:
find command is to used find files from the directory
ex :find . -name raju            (Here raju is the file name)
      find . -type f                    (it will list all the files in curent directory)
      find .-perm 777              (it wil list all the files whose having permissions with 777)
--------------------------------------------------------------------------------------------------------------------------------
grep command is used to search pattren within a file.
Syntax: grep "pattren" filename
Ex: it used to search the contents inside the file
for suppose take a file by name raju
it contains
hat
bat
soap
SOAP
cat raju
hat
bat
soap
SOAP
now if u want see the word hat where it is is located
grep -i hat *
grep -i hat raju
grep -a hat raju

$ find . -type grep "unix"
$ find . -type grep  -i "unix"
...this command will search all file (from all directories not only from current directory) having word unix. While if use only command grep "unix", it will search only in current directory.
==================================================================================
To find the string in all the files
grep <string> *
Search for a given string in all files recursively
$ grep -r "raju" *
To find the string in the files in all the sub directories
find . -type f -print | grep <string>

To know our AIX Version is http or openssl
root@nabdcweb2:/#lslpp -l | grep http
root@nabdcweb2:/#lslpp -l | grep openssl
  openssl.base            0.9.8.1800  COMMITTED  Open Secure Socket Layer
  openssl.license         0.9.8.1800  COMMITTED  Open Secure Socket License
  openssl.man.en_US       0.9.8.1800  COMMITTED  Open Secure Socket Layer
  openssl.base            0.9.8.1800  COMMITTED  Open Secure Socket Layer

To find which java files was stuck
bash-3.2$ps -ef | grep java
bash-3.2$ps -ef | grep TEST  (TEST is an Appserver domain name)
bash-3.2$ps -ef | grep ora_
To kill the process use below command
bash-3.2$kill -9 processid
Examples of grep commands
1)grep - globally search for a regular expression and print all lines containing it.
tsd1 $ ls -ltr | grep "Aug"  (This command will show the details of folder which was in august month)
o/p:
-rwxrwxrwx 1 tsd1 psoft 351 Aug 8 2011 peopletools.properties
drwxrwxrwx 4 tsd1 psoft 96 Aug 8 2011 appserv
-rwxrwxrwx 1 tsd1 psoft 17 Aug 23 2011 obfuscate.txt
drwxrwxrwx 3 tsd1 psoft 96 Aug 26 2011 oradiag_tsd1
2)if you want both upper and lower case -- use option -i
tsd1 $ ls -ltr | grep -i "People"    (This command will search for the particular folder like People)
O/P:
-rwxrwxrwx 1 tsd1 psoft 351 Aug 8 2011 peopletools.properties
3) if you want zero or more of seaching .*
tsd1 $ ls -ltr | grep -i ".*java"  (This command will search for java files or folders that started with name of java)
O/P:
-rwxrwxrwx 1 tsd1 psoft 9750 Jan 4 01:00 java3.log
-rw-rw-r-- 1 tsd1 psoft 0 Jan 15 01:01 java2.log.lck
-rwxrwxrwx 1 tsd1 psoft 0 Jan 15 01:01 java2.log
-rw-rw-r-- 1 tsd1 psoft 0 Jan 15 01:01 java1.log.lck
4) The sort option +4n skips four fields (fields are separated by blanks) then sorts the lines in numeric order.
ls -l | grep "Aug" | sort +4n
O/P:
-rwxrwxrwx 1 tsd1 psoft 17 Aug 23 2011 obfuscate.txt
drwxrwxrwx 3 tsd1 psoft 96 Aug 26 2011 oradiag_tsd1
drwxrwxrwx 4 tsd1 psoft 96 Aug 8 2011 appserv
-rwxrwxrwx 1 tsd1 psoft 351 Aug 8 2011 peopletools.properties
5) pg command - to see page by page
$ pg filename   (If any page is having more pages then this is used to view that page by page by pressing enter key)
$To search the word in multiple files
# cat file1 file2 file3 | grep /word search

How to know RAM Size in AIX or LINUX
# lsconf | grep Memory
bash-3.2$ lparstat -i | grep Memory
O/P:
            Online Memory                              : 23296 MB( In the entire server this 22.75 GB Ram we are utilizing)
            Maximum Memory                             : 30720 MB
            Minimum Memory                             : 18432 MB
            Memory Mode                                : Dedicated
            Total I/O Memory Entitlement               : -
            Variable Memory Capacity Weight            : -
            Memory Pool ID                             : -
            Physical Memory in the Pool                : -
            Unallocated Variable Memory Capacity Weight: -
            Unallocated I/O Memory entitlement         : -
            Memory Group ID of LPAR                    : -
            Desired Memory                             : 23296 MB( This is allocate RAM Size of the entire server)
            Target Memory Expansion Factor             : -
            Target Memory Expansion Size               : -
==================================================================================
To search the word in the text file
bash-3.2# grep -r "column" /home/script.sh    (It will search the "column" word in "script.sh" file & this will show the path of the script.sh file)
bash-3.2# grep "column" /home/script.sh       (It will search the "column" word in "script.sh" file this will not show the path)
bash-3.2# grep -r "LAST" /home/                     (It will search the "column" word in in the entire /home folder)
Search for the given string in a single file
Syn:   grep "literal_string" filename
grep 'word' filename
grep 'word' file1 file2 file3
grep 'string1 string2'  filename
==================================================================================
To see the environment variable for particular path:
   bash-3.2$ env |grep PS_SERVDIR
      O/P:   PS_SERVDIR=/home/psoft/CACHE
To search particular word in that file in unix
#grep -i "word you want to search" /home/psoft/smit.log--------------->It will search in smit.log file
Command to check the shared memory segment
ipcs –m | grep 0x741
Check whether shared memory segments are created again with following command.
ipcs -m | grep 0x741                 (with root user)

To know more information on grep and find commands
$ man find
$man grep


shutdown command examples :
Shutdown the system and turn the power off immediately
# shutdown -h now
Shutdown the system after 10 minutes
# shutdown -h +10
Reboot the system using shutdown command
# shutdown -r now
Force the filesystem check during reboot.
# shutdown -Fr now

10 Oct 2013

Mandatory Process for PSAPP Server

Mandatory Processes in PeopleSoft Application Server
People soft processes are designed to communicate with database. At the direction of WSH/JSH, the PS process queries the database and objects using SQL. The Mandatory PS processes are
1.     PSAPPSRV
2.     PSSAMSRV
3.     PSQRYSRV
4.     PSQCKSRV
5.     Specialized Services
  • PSDBGSRV
  • PSOPTENG
  • PSBRKDSP
  • PSBRRHND
  • PSPUBDSP  (Dispatcher)
  • PSPUBHND (Handler)
  • PSSUBDSP
  • PSSUBHDN

What are these PeopleSoft processes used for ?
1. PSAPPSRV
The PSAPPSRV Builds and save HTML pages, run the people code, process messages and handles most client SQL request. It also performs user authentication duties when client initially login.
2. PSSAMSRV:
The PSSAMSRV Process Conversion SQL transactions primary for the application Designer Development Tools.
3.PSQRYSRV:
It’s a specialized process that handle all SQL generated from the PS query tools, while this service does not need to be started for the domain to run. Not having PSQRYSRV configured can lead to poor performance.
4. PSQCKSRV:
It’s a specialized process from this handler all shorter read only client request. This server is not currently used by the PIA client and does not need to be started for the domain to run.
5. Specialized Services
a)      PSDBGSRV: Supports PS People Code Debugging sessions.
b)      PSOPTENG: its used for optimization based application functions and supply chain planning etc.
c)      PSBRKDSP: These are the services that manages integration broker queues PSBRKHND
d)     PSBRKHND: The dispatcher (DSP) picks up request and pass them to the handler (HDN), which determines the Type redirects, the request to the Proper queue for further processing.
e)      PSPUBDSP & PSPUBHND: These two-publication dispatcher and handler are responsible for publications out bound message from the Integration broker environment formatting the information and rooting it to the proper external systems.

f)    PSSUBDSP & PSSUBHND: These two-subscription dispatcher (DSP) and HND (Handler) are responsible for processing subscription in bound messages from external system.

Imp files of App,Prcs,Tuxedo and Web Server

What are Important Files in Tuxedo Directory
As you would know that PeopleSoft has several different components which have their own role to play in PeopleSoft Architecture. These components have different file structures and contains important executables and configuration files. We have listed the directory structure of these major PeopleSoft components and compiled a list of important directories and file within them.
Below are the major components of PeopleSoft System.
1.File server
2.Web server
3.Application Server
4.Tuxedo
5.Batch server / Process scheduler
6.Database server
This post will discuss about the Tuxedo directories and configuration Files.
  • Tuxedo remains the centre of the application server.
  • There are many advantages to having an application server performing transaction management for you.  Probably the biggest advantage is the thin Tuxedo and Jolt communication protocols available for communicating with the client.
  • Without an application server, the client has to communicate with the database in SQL.  The work done by server processes in the domain can be broken down roughly as follows, divided between “Business” servers and Tuxedo
  • Tuxedo and Jolt must be installed on any host system that you plan to use as an application server.  Remember that Jolt is simply a Java-enabled version of Tuxedo.
On Windows Tuxedo would be installed in C:\Tuxedo. Below are the important directories and files
Apps:                             It contains the tuxedo application related folders.
Bin:                                 It contains the tuxedo executables
Lib:                                 It contains the library files
Patchlev:                        It provides the tuxedo patch level information
Joltpatchlev:                   It provides the jolt patch level information
Lic:                                 It provides the tuxedo version details
What are Important Files on PeopleSoft Application Server

This post will discuss about the PeopleSoft Application Server directories and configuration Files.
  • Application server is responsible in communication with the database
  • Application server cannot exist alone; it has to co-exist with tuxedo.
  • Application server is a collection of processes such as PSAPPSRV, PSQRYSRV, PSSAMSRV etc,
  • There can be more than one domain configured in an Application server
  • Each domain has its own key configuration files
Psappsrv.cfg:   This configuration file contains the information about the Jolt/Wsl port numbers, domain settings and all other important details pertaining to the domain.
Psappsrv.ubb: PSADMIN invokes a PeopleSoft developed sub-program named UBBGEN, which takes the configuration parameters and builds the file psappsrv.ubb.
Psappsrv.ubx:  This is a domain template file which has all the parameters.UBBGEN will open the file psappsrv.ubb, process it and produce this file.
Psappsrv.val:    This is a validation file which validates the entry in the configuration file such as the database type, jolt port limitation etc.
Psappsrv.env:     This file has the information about the path to appserver executables and path information for database connectivity.
PSTUXCFG:   This is the configuration file generated by loading the psappsrv.ubb file using the tuxedo load command (tmloadcf). This is a binary file and is used while the domain is booted.
What are Important Files on PeopleSoft Process Scheduler

This post will discuss about the PeopleSoft Process Scheduler Server directories and configuration Files.
  • Peopletools Process Scheduler is a centralized tool that enables application developers, system administrators, and application users to manage PeopleSoft batch processes. Using the PeopleSoft Internet Architecture (PIA), you can access a list of processes through a web browser and queue and run a process request
  • Process scheduler can be on NT or Unix OS, by the way it’s called as PSNT/PSUNX.
  • Process scheduler is again a collection of processes such as PSAESRV, PSPRCSRV, and PSDSTSRV… These processes are started using the psadmin.exe utility
  • More than one domain can be configured in a Process scheduler server
Process Scheduler Location: PS_HOME/appserv/prcs
LOG_OUTPUT:       This contains the output of the files generated by the process scheduler.
LOGS:                             This directory contains the tuxedo log, process scheduler log and distributor services log.
Psprcs.cfg:                  This file contains the parameters like the database name, sqrbin, oracle bin etc
 Psprcsrv.ubb:         PSADMIN invokes a PeopleSoft developed sub-program named UBBGEN, which takes the configuration parameters and builds the file psprcsrv.ubb
Psprcsrv.ubx:           This is a domain template file which has all the parameters.UBBGEN will open the file psprcsrv.ubb, process it and produce this file.
Psprcsrv.val:             This is a validation file which validates the entry in the configuration file such as the database type, jolt port limitation etc.
Psprcsrv.env:           This file has the information about the path to appserver executables and path information for database connectivity
PSTUXCFG:                This is the configuration file generated by loading the psprcsrv.ubb file using the tuxedo load command (tmloadcf). This is a binary file and is used while the domain is booted.
Become a PeopleSoft Expert!
What are Important Files on PeopleSoft Web Server

This post will discuss about the PeopleSoft Web Server directories and configuration Files.
  • Weblogic, the Webserver can be installed on Windows or Unix OS.
  • Weblogic can have different versions with appropriate service packs as per the installed tools and application version
Config.xml                    This XML file is helpful at the time of booting this Webserver  domain. Any changes in this file can abrupt the functioning of the Peoplesoft n-tier environment.
setEnv.cmd                 This bat file has the environment variables such as JRE home set.
StartPIA.cmd             This bat file starts Weblogic for the specified domain.
StopPIA.cmd              This bat file stops Weblogic for the specified domain.
Configuration.properties:    This file has information about the appserver, jolt port, http and https port, Webserver settings
Psp.class:                      This servlet interacts with the Webserver and appserver. The psp.class servlet program establishes a connection to handle your browser’s connection
on the web server side.





Top of Form

PeopleTools Tables

Complete List of PeopleSoft Tables

PeopleTools Tables

PSPROJECTDEFN: Project header table
PSPROJECTITEM: Definations in the project
Fields Tables:
PSDBFIELD: Fields in the s/m
PSXLATVALUES: Translate values
Records Tables:
PSRECDEFN: Record header table
PSRECFIELDALL: Fields & subrecords in the record
PSKEYDEFN: Indexes
Components:
PSPNLGROUP: Pages in the components
PSMENUITEM: Components on the menu
Change control:
PSCHGCTLHIST: Shows history of  locked defs with project name , incident & descp.
PSCHGCTLLOCK: shows def that are currently locked.
Security tables:
PSCLASSDEFN: Permission list header table
PSAUTHITEM: Menu items granted security by permission lists.
PSROLEDEFN: Role header table
PSROLECLASS : Permission lists in roles
PSOPRDEFN:  userid header table
PSROLEUSER: Roles granted to users
Portal:
PSPRMSDEFN: Content references & folders
PROCESS SCHEDULER TABLES:
PSPRCSRQST,PSPRCSQUE,PSPRCSPARAMS,PS_PRCSRQSTDIST,PS_MESSAGE_LOG,PSPRCSRQSTTEXT,PS_MESSAGE_LOGPARM,PSPRCSRQSTXFER,PS_CDM_LIST   (All these tables should be in sync).

PeopleSoft Object Definition Tables

PSACTIVITYDEFN
 Activity definitions are stored
PSAESECTDEFN
 Stores the application engine section definitions
PSAESTEPDEFN
 Stores the application engine step definitions
PSAESTEPMSGDEFN
 Stores the messages of the AE programs
PSPCMPROG
 Peoplecode programs stored
PSSQLTEXTDEFN
 Application engine sql
PSAEAPPLDEFN
 Application engine program name
PSMENUDEFN
 Menu names
PSPNLDEFN
 Page names
PSPNLGROUP
 Stores Component definitions
PSBCDEFN
 Stores component interface names
PSBUSPROCDEFN
 Stores Business process definitions
PS_APPR_RULE_HDR
 Stores Approval rule set definitions
PSCHNLDEFN
 Stores channel definitions
PSEVENTDEFN
 Changing the column value of active to 0 leads to disabling activities
PSFLDFIELDDEFN
 Filelayout stored
PSFILEREDEFN
 File reference stored
PSINDEXDEFN
 Index information stored
PSIODEFN
 Stores business interlink information
PSKEYDEFN
 Stores the index key information
PSMPDEFN
 Contains info about mobilepages
PSMSGAGTDEFN
 Refers to the activity object
PSMSGCATDEFN
 Related to Messages -  Message catalogs
PSMSGDEFN
 Stores Application Message definitions
PSDBFIELD
 Contains field definitions
PSDDLDEFPARMS
 This table holds the storage structure of the tables for db platforms
PSGATEWAY
 This table hold the gateway url.
PSIDXDDLPARM
 This table holds the storage structure of the indexes for db platforms
PSRECDEFN
 This table holds the information of all the peoplesoft records.
PSPACKAGEDEFN
 This table holds the application packages definitions
PSPNLGRPDEFN
 Contains Panel group definitions
PSPRDMDEFN
 Contains the portal information
PSPROJECTDEFN
 Contains project definitions
PSPRSMDEFN
 Detailed information of the portal objects
PSPRUFDEFN
 Information about portal objects
PSPRUHDEFN
 Information about portal objects
PSQRYDEFN
 Holds the query definitions
PSROLEDEFN
 Role definitions
PSSQLDEFN
 SQL object definitions are stored
PSSQLTEXTDEFN
 SQL object’s text are stored
PSSTEPDEFN
 Contains stepnames with reference to the activity
PSSTYLEDEFN
 Contains the styles definitions
PSSTYLSHEETDEFN
 Contains the stylesheet definitions
PSSUBDEFN
 Conatins Message subscription definitions
PSTOOLBARDEFN
 Holds a single row provided by PS, which helps to view the toolbar
PSTREEDEFN
 Contains the treename
PSCLASSDEFN
 Gives info abt the peoplesoft permission lists
PSURLDEFN
 To see which URL’s are used as fileservers for the file attachments
PS_AE_TEMPREC_VW
 Tracks all temporary tablenames and their descriptions
PS_AE_TEMPLOCK_VW
 Tracks how many locks are currently in effect for a particulartemporary table
PS_DATA_FIND_BASE
 Used as search record for the panel.  SHould always be empty.
PS_MSG_CATLG_VW
 Contains text for all error messages and warnings.

PeopleSoft Security Tables

PSROLECLASS
 Provides the permission lists associated to each role
PSROLEUSER
 Gives info abt the roles assigned to the Oprid’s

PeopleSoft Login Details and Authorization

PSACCESSLOG
 Login and logout information of the users


PSACCESSPRFL
 Contains the symbolic id,accessid/password details.
PSCLOCK
 Login fails if the table is empty
PSOPRDEFN
 This table holds the peoplesoft Oprid’s/passwords info with symbolic id.

PeopleSoft Audit Tables

PSAUDIT
 This table holds all the changes for panel/record modifications

PeopleSoft Version Details

PSRELEASE
 This table holds the application release details
PSSTATUS
 This table gives the peopletools information

PeopleSoft Language Details

PSLANGUAGES
 Contains 1 for the column INSTALLED against the columnLANGUAGE_CD.

PeopleSoft Modules Listed

PS_INSTALLATION
 List the modules in the database

PeopleSoft Process Type Details

PS_PRCSDEFN
 Contains process type and process names
PSPRCSLOCK
 Contains a single record, this gets updated when a process is submitted

PeopleSoft Process Status

PSPRCSQUE
 Holds the process rqst details should be in synch with psprcsrqst.Should be in synch with PSPRCSRQST
PSPRCSRQST
 This table holds the process submitted details
PS_CDM_LIST
Contains the process instance details.Should be in synch withPS_CDM_AUTH
PS_CDM_AUTH
 Contains the process instance details

PeopleSoft Report Node Details

PS_CDM_DIST_NODE
 This table holds the report node information which contains the reportrepository details
PS_CDM_DISTSTATUS
 Contains the definition of report status

PeopleSoft Batch Server Details

PS_SERVERDEFN
 Contains the server definitions
PSSERVERSTAT
Gives information about the batch server status

PeopleSoft RenServer Details

PSREN
 Holds the portnumber details of a renserver configured domain

PeopleSoft Translate Value Details

PSXLATDEFN
 Holds the translate fieldname and version number for caching
PSXLATITEM
 Holds the translate fieldname and their values

PeopleSoft Object Versions

PSLOCK
 This table is used for version control
PSOPTIONS
 This table is used to turn off or on the change control enabling feature
PSVERSION
 This table holds the version number details

Though we tried to compile a comprehensive list of all PeopleSoft tools tables but we may have missed some of those. If you know of any other important tables which are not present in above list, please do share with us in comment section below.