Thursday, December 8, 2011

Regular Commands in UNIX


a)      To find out the running processes the command is                 :Ps – ef| grep java
b)       To find out the disk space the command is                           :du
c)      To find out the file system the command is                            :df
d)     To find out the network performance/port info command is   :netstat
e)      To find out the CPU utilisation the command is                     : topas/osstat
f)       To kill the running process the command is                           : kill -9 <PID>
g)      To generate heap/thresd dump the command is                    :kill -3 <PID>
h)      To  change the privileges of the file/folder the command is    : chmod
i)        To  change the owner of the file/folder the command is         :chown
j)        To  list the file the command is                                             : ls
k)      To create DIR(folder) the command is                                 :mkdir
l)        To TAR the files ,folders we use the following command
Tar –xvf  <file name with path>         --
Tar – uvf                                             --adding one or two files two folder
Tar – cvf                                              -- total folder
m)    To schedule the job in cron command is as follwos
Crontab –l ( to list all the scheduled jobs)
Crontab –e ( to edit the  scheduled job)
                        Whithin the crontab the syntax for the schedule the script as follows
Ex:  30 6  *  * 1,3,5  /usr/bin/calender
30(minutes)  6 (hours) *(day of the month)  * (month of the year) 1,3,5  (day no of the week)/usr/bin/calender
In the  above example we scheduled the script called calender which is located in the location “/usr/bin” to run every  Monday,Wednesday and friday
n)      To find fully qualified domain name (FQDN) if you know IP
$ Nslookup <IP_ADDRESS>                                    --(vice versa)

Setting webcontainer custom properties

An example jacl script which creates a webcontainer custom property, after deleting any current instances of the property being added, might contain the following but with lines 2 to 6 modified to specify appropriate values for <cell of server>, <node of server>, <server to create property for>,
<webcontainer property name> and <webcontainer property value>:

# set variables
set cellName <cell of server>
set nodeName <node of server>
set serverName <server to create property for>
set propertyName <webcontainer property name>
set propertyValue <webcontainer property value>
# define some helper variables
set a1 [list name $propertyName]
set a2 [list value $propertyValue]
set attrs [list $a1 $a2]
# get server config
set server [$AdminConfig getid
/Cell:$cellName/Node:$nodeName/Server:$serverName/]
#get the webcontainer config from the server config
set webcontainer [$AdminConfig list WebContainer $server]
# get a list of existing webcontainer properties
set webcontainerProperties [$AdminConfig list Property $webcontainer]
# Check for existing properties with the same name and delete if found
if { ${webcontainerProperties} != "" } {
foreach propertyID ${webcontainerProperties} {
set propertyIDName [$AdminConfig showAttribute $propertyID name]
set match [string match $propertyIDName $propertyName]
if { ${match} == 1 } {
$AdminConfig remove $propertyID
}
}
}
# Create the specified property
$AdminConfig create Property $webcontainer $attrs
# Save updates
$AdminConfig save