Thursday, June 30


Create tape archives and add or extract files.
Note: A ".tar" file is not a compressed files, it is a collection of files within a single file uncompressed. If the file is a .tar.gz ("tarball") or ".tgz" file it is a collection of files that is compressed. If you are looking to compress a file you would create the tar file then gzip the file.

How to tar a file

 SYNTAX:  
 tar  -cvf  < filename >.tar  /< File directory location >/

 Example: 
 tar -cvf domainconfig_bms.tar domainconfig
 tar -cvwf file.tar myfile.txt

  • c – create a new archive
  • v – verbosely list files which are processed.
  • f – following is the archive file name
  • z – filter the archive through gzip 
  
How to untar a file

SYNTAX: 
tar  -xvf  < filename >.tar
tar  -xvwzf myfile.tar
tar  -xvwzf myfile.tar.gz 


Example: tar –xvf  domainconfig_bms.tar

inode (index node)

The inode (index node) is a fundamental concept in the Linux and UNIX file system. Each object in the file system is represented by an inode.

What is Inode?

Definition:
An inode is a data structure on a traditional Unix-style file system such as UFS or ext3. An inode stores basic information about a regular file, directory, or other file system object.
In a file system, a file is represented by an inode. Inodes are data structures that contain information about files that are created when a file system is created. Each file has an inode and is identified by an inode number in the file system where it resides.
The following information are stored in inode.
Owner and group owner of the file.
• File type
• Permissions on the file.
Date and time of creation, last read and change.
• Date and time this information has been changed in the inode.
• Number of links to this file
• File size
• An address defining the actual location of the file data.
Only information that is not stored in inode is its file name and data.

How do I see file inode number?

You can display the inode number associated with a file, use "ls" command along with " -i" option
inode 

Inode application:

If we have files in our system without name or with special characters then we can use inode to remove those files.
rm cannot be used to remove files having blank name or name with special characters.
For Ex:
Below image shows result of ls –lrti. You can see file without name, but with inode number as 2562.
We can use below command to remove this file:
This way we can remove unwanted files from our system and can save disk space.
To remove files having created with control characters or characters which are unable to be input on a keyboard or special character such as ?, * ^ etc. You have to use indoe number to remove file.

Tuesday, June 28

Mount Comamnd In Unix/Linux


Mount Comamnd In Unix/Linux

The Unix command line utility mount instructs the operating system that a file system is ready to use, and associates it with a particular point in the system's file system hierarchy (its mount point). The counterpart umount instructs the operating system that the file system should be disassociated from its mount point, making it no longer accessible. The mount and umount commands requireroot user privilege or the corresponding fine-grained privilege, unless the file system is defined as "user mountable" in the /etc/fstab file (which can only be modified by the root user).

Use
The second partition of a hard disk is mounted with the command
$ mount /dev/hda2 /new/subdir
and unmounted with the command:
$ umount /dev/hda2 
or 
$ umount /new/subdir
 
To list all all mounted fill systems
$ mount 
 
To remount a partition with specific options
$ mount -o remount,rw /dev/hda2
 
To Mount all file system in fstab
$ mount -a
 
Return Codes
 
       mount has the following return codes (the bits can be ORed):
 
       0      success
       1      incorrect invocation or permissions
       2      system error (out of memory, cannot fork, no more loop devices)
       4      internal mount bug or missing nfs support in mount
       8      user interrupt
       16     problems writing or locking /etc/mtab
       32     mount failure
       64     some mount succeeded
Files


       /etc/fstab         file system table
       /etc/mtab          table of mounted file systems
       /etc/mtab~         lock file
       /etc/mtab.tmp      temporary file
       /etc/filesystems   a list of filesystem types to try

touch command:


touch command:

We all know the command touch and we generally use it for creating a 0 byte file (similar to “filename” or “cat /dev/null > filename” or “cp /dev/null filename”). But many of us don’t know that the main use of touch is to update/change the access, modification and last changed times of a file.

Basic Options:

touch 123.txt – will update the times of 123.txt to current time OR creates 123.txt with current date, if NOT exists.

touch –t “timestamp” 123.txt - will update the times of 123.txt to timestamp OR creates 123.txt with timestamp.

Timestamp - [[CC]YY]MMDDhhmm[.SS]

                          CC   The first two digits of the year. (optional, if its 19)

                          YY   The second two digits of the year.  [CCYY is optional, if its same year)

                          MM   The month of the year (01-12).

                          DD   The day of the month (01-31).

                          hh   The hour of the day (00-23).

                          mm   The minute of the hour (00-59).

                          .SS   The second of the minute (00-61). (optional, if its 00)

touch -t 01010000.00 123.txt
-rw-r--r--   1 vs1250     ospcm            0 Jan  1 00:00 123.txt

touch -t 201501010000.00 123.txt
-rw-r--r--   1 vs1250     ospcm            0 Jan  1  2015 123.txt


touch -t 8601010000.00 123.txt
-rw-r--r--   1 vs1250     ospcm            0 Jan  1  1986 123.txt

Now, whatever we see above will update the timestamps of both access and modification times of the file.

–a option is to change only the access time and
–m option is to change only the modified time.

touch -a -t 201501010000.00 123.txt - will update the access time of123.txt to timestamp. If NOT exist, it creates 123.txt with timestamp as access time and current time as modified time.
touch -m -t 201501010000.00 123.txt - will update the modify time of123.txt to timestamp. NOT exist; it creates 123.txt with timestamp as modified time and current time as access time.

-r option is to change the times of a file with that of another file.

touch -r 123.txt newfile.txt - will update the times of newfile.txt with that of 123.txt.
-rw-r--r--   1 vs1250     ospcm            0 Jan  1 00:00 newfile.txt
-rw-r--r--   1 vs1250     ospcm            0 Jan  1 00:00 123.txt

You can mix the combination of the options and use them for various needs. BUT, always –t and –r should be used exclusively.

cron: Job Scheduler


cron: Job Scheduler
The crontab utility is mostly used to run jobs at the same time every day, every month, or every year. Every minute, the system checks a system file, called crontab, to see which (if any) processes/jobs need to be started.
There are four ways to manipulate the crontab file:     

crontab [filename] 

crontab -l [username] 

crontab -r [username]  
NOTE: Be careful in using the first method: if a crontab file already exists, it will be overwritten!! (To avoid the file being overwritten, escape using CTL-c, NOT CTL-d).
Every line in the crontab file contains six fields, each separated by a space. A field may contain more than one value, each separated by a comma. An $\ast$means ``all values".
The fields are:
  1. minute: values are 0 to 59.
  2. hour: legal values are 0 to 23.
  3. date of the month: 1 to 31.
  4. month: 1 to 12 (Jan - Dec).
  5. day of the week: 0 to 6 (Sun - Sat).
  6. Bourne shell command.
Here is an example of what a crontab file would look like:
0 0 * * * /usr/bin/new.messages 
0,15,30,45 * * * * /usr2/people/cantin/check.mail 
0 0 1 1 * /usr2/people/cantin/new.year.message
The first line on the above example runs the command new.messages at 0 minutes, 0 hours (midnight), every day, every month (i.e., every day at midnight).
The second line runs /usr2/people/cantin/check.mail every fifteen minutes.
Finally, the third entry runs new.year.message the first of January, at midnight.

Sunday, June 26

Commands using weblogic.Admin



1. Starting a managed server- java weblogic.Admin -url -username -password START

2. Finding the state of a server - java weblogic.Admin -url -username -password GETSTATE

3. Shutting down a server- java weblogic.Admin -url -username -password SHUTDOWN

4. Starting a Cluster- java weblogic.Admin -url -username -password STARTCLUSTER -clustername

5. Shutting down a cluster- java weblogic.Admin -url -username -password STOPCLUSTER -clustername

6. Finding a state if a cluster- java weblogic.Admin -url -username -password CLUSTERSTATE -clustername

Friday, June 24

DBPing Command


DBPing Utiity In Weblogic


Ensure you have set weblogic.jar in the classpath and have JAVA_HOME set properly before executing the dbping command.
1)export PATH=/jdk150_11/bin:$PATH
2)export CLASSPATH=$CLASSPATH: /Weblogic/utils/bea101/wlserver_10.0/server/lib/weblogic.jar

Follow the synatax available on utils.dbping 
$ java utils.dbping DBMS [-d dynamicSections] user password DB 
$ java utils.dbping ORACLE_THIN USERNAME PASSWORD IP:PORT/SID

Ex: 
java -cp /WebLogic/utils/bea815/weblogic81/server/lib/weblogic.jar utils.dbping ORACLE_THIN KrishnaDB KrishnaPWD KrishnaDBServer:1536/KrishnaDB


Note: The telnet command and the ping might give as success but that is *NOT* the correct way to check the connectivity to database from WebLogic servers.
 

Examples

The following is an example using the Oracle Thin Driver.
C:\>java utils.dbping ORACLE_THIN scott tiger dbserver1:1561:demo

**** Success!!! ****

You can connect to the database in your app using:

java.util.Properties props = new java.util.Properties();
  props.put("user", "scott");
  props.put("password", "tiger");
  props.put("dll", "ocijdbc9");
  props.put("protocol", "thin");
  java.sql.Driver d =
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
  java.sql.Connection conn =
    Driver.connect("jdbc:oracle:thin:@dbserver1:1561:demo", props);

Thursday, June 9

SOP FOR RESET ADMIN USERNAME/PASSWORD ( WLS 9.X )

STEP 1:
Ensure that your have shutdown all servers -- Admin

STEP 2:
From the command line, run the script setDomainEnv.sh, located in
$DOMAIN_HOME/bin/setDomainEnv.sh

STEP 3:
Cd to $DOMAIN_HOME/security
Rename the file 'DefaultAuthenticatorInit.ldift'

STEP 4:
Create a new initialization file for the default authenticator in the same directory as above
($DOMAIN_HOME/security) by running command:
java –cp
/WebLogic/utils/bea922/weblogic92/server/lib/weblogic.jar:$CLASSPATH
weblogic.security.utils.AdminAccount .

This should produce a new 'DefaultAuthenticatorInit.ldift'
(Can be verified with the timestamp of that file)

STEP 5:
Rename the files 'DefaultAuthenticatormyrealmInit.initialized' and 'boot.properties'.

$DOMAIN_HOME/servers/AdminServer/data/ldap/DefaultAuthenticatormyrealmInit.initialized

$DOMAIN_HOME/servers/AdminServer/security/boot.properties

STEP 6:
Start the Admin server

At start time, use the newUser and newPassword values when prompted for user and
Password.

Tuesday, June 7

Monday, June 6

Website page is uploading slow

Website page is uploading slow

1. Check from application console, whether application page is uploading with in defined timestamp.
2. Check from console free server memory and number of free threads
3. Issue may be from network side also to make sure try to open URL's of other applications and check those application response time.

Friday, June 3

Deploy Application


Weblogic.Deployer:
Weblogic.Deployer is a Java-based deployment tool that provides a command-line interface to the WebLogic Server deployment API
Usage: java weblogic.Deployer [options] [action] [Deployment units(s)]
java weblogic.Deployer -help to display all the available options

Deploy application on admin server:
java weblogic.Deployer -adminurl url -username username -password password -name myapp -deploy c:/myapps/myapp.ear

Deploy individual modules in application to different targets:
java weblogic.Deployer -adminurl url -username username -password password -name myapp -targets mywar@webserver,myjar@ejbserver -deploy c:/myapps/myapp.ear

Undeploy application from specified targets:
java weblogic.Deployer -adminurl url -username username -password password -name myapp -undeploy -targets server1,server2..

Redeploy application on current targets:
java weblogic.Deployer -adminurl url -username username -password password -name myapp –redeploy

Redeploy individual module in an application:
java weblogic.Deployer -adminurl url -username username -password password -name myapp -redeploy -targets moduleA@serverA,moduleA@serverB

Partially redeploy, for example, to update a JSP in a exploded webapp:
java weblogic.Deployer -adminurl url -username username -password password -name myapp -redeploy mywar/index.jsp
The path of JSP to be updated is relative to the root of the application. If a directory is specified the entire subtree is updated.

Multiple servers sharing the same physical deployment:
java weblogic.Deployer -adminurl url -username username -password password -name myapp -targets server1,server2 -nostage -deploy c:/myapps/myapp.ear
The -nostage option indicates that the application is available on all target servers at the same path and hence server should not copy files to the managed servers.

Deploy the first application version on admin server:
java weblogic.Deployer -adminurl url -username username -password password -name myapp -deploy c:/myapps/myapp_v1.ear
Perform Production Redeployment of a new application version on admin server:

java weblogic.Deployer -adminurl url -username username -password password -name myapp -redeploy -source c:/myapps/myapp_v2.ear

Deploy application to administration mode on admin server:
java weblogic.Deployer -adminurl url -username username -password password -name myapp -deploy c:/myapps/myapp.ear -adminmode

Transition application from administration mode to running on admin server:
java weblogic.Deployer -adminurl url -username username -password password -name myapp -start
Transition application from running to administration mode on admin server:
java weblogic.Deployer -adminurl url -username username -password password -name myapp -stop -adminmode

Deploy a library on admin server:
java weblogic.Deployer -adminurl url -username username -password password -name mylib -library -libspecver 1.0 -libimplver 2.0 -deploy c:/myapps/mylib.jar

Deploy an application on admin server with a deployment plan:
java weblogic.Deployer -adminurl url -username username -password password -plan c:/myapps/myapp/plan/plan.xml -deploy c:/myapps/myapp/app/myapp.jar

Update an application configuration:
java weblogic.Deployer -adminurl url -username username -password password -plan c:/myapps/myapp/plan/newplan.xml -name myapp -update

Deploy a queue to a specific JMS server
java weblogic.Deployer -adminurl url -username username -password password -submoduletargets myqueue@myjmsmodule@JMSServer
-deploy c:/myapps/myapp/app/myapp.ear