Tuesday, August 17, 2010

Change Solaris Server hostname

Change the hostname in the following files:

/etc/nodename
/etc/hostname.*interface
/etc/inet/hosts
/etc/inet/ipnodes

Wednesday, August 04, 2010

Reverse proxy configuration on Apache

Apache Server side configuration.

mod_proxy_html installation reference link http://ubuntuforums.org/showthread.php?t=350836

wget http://apache.webthing.com/mod_proxy_html/mod_proxy_html.tgz
tar -xvzf mod_proxy_html.tgz
cd mod_proxy_html
-----------------------
apt-get install apache2-prefork-dev
apt-get install libxml2-dev
ln -s /usr/include/libxml2/libxml /usr/include/libxml
apxs2 -i -c mod_proxy_html.c
------------------------------------------

Modules for proxy settings
--------------------------------
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadFile /usr/lib/libxml2.so.2
-----------------------------------------------------------------------------

NameVirtualHost *:443
NameVirtualHost *:80

ServerName linuxmediaserver.mlmail.net
DocumentRoot /var/www/
ErrorLog /var/log/httpd/error.log
CustomLog /var/log/httpd/access.log combined
ProxyRequests Off
Order deny,allow
Allow from all
ProxyPass / http://server.domain.com/
ProxyPassReverse / http://server.domain.com/

ServerName linuxmediaserver.mlmail.net
DocumentRoot /var/www/
ErrorLog /var/log/httpd/error.log
CustomLog /var/log/httpd/access.log combined
SSLEngine on
SSLCertificateFile /etc/httpd/ssl/mycert.pem #---------------> Generated certificate
ProxyRequests Off
Order deny,allow
Allow from all
ProxyPass / http://server.domain.com/
ProxyPassReverse / http://server.domain.com/

Monday, July 26, 2010

Apache Bench test

Apache bench test can be done to find the apache server performance.
We can run multiple simultaneous connections to the apache server and check the server response time.

Download apace bench marker from the below site.
http://www.filewatcher.com/m/ApacheBench-0.62.tar.gz.61627.0.0.html


Install Apache Bench mark -
wget ftp://ftp.eenet.ee/pub/cpan/authors/id/A/AD/ADIRAJ/ApacheBench-0.62.tar.gz
mv ApacheBench-0.62.tar.gz to /opt

tar -zxvf ApacheBench-0.62.tar.gz
cd /opt/ApacheBench-0.62
perl Makefile.PL
make
make test (requires Term::ReadKey for execute() test)
make install

Now AB is installed you can run the testing from command.
ab -n 10000 -c 5 http://(servername)/index.html

-n requests Number of requests to perform
-c concurrency Number of multiple requests to make

Result
=====
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking xxx.xxx.xxx.xxx (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests


Server Software: Apache/2.2.10
Server Hostname:
Server Port: 80

Document Path: /index.html
Document Length: 197 bytes

Concurrency Level: 10
Time taken for tests: 6.98762 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 4440000 bytes
HTML transferred: 1970000 bytes
Requests per second: 1639.68 [#/sec] (mean)
Time per request: 6.099 [ms] (mean)
Time per request: 0.610 [ms] (mean, across all concurrent requests)
Transfer rate: 710.80 [Kbytes/sec] received

=========

Sunday, June 27, 2010

Powering ON or OFF system using wake on LAN

http://www.tjansson.dk/?p=83
http://www.raymond.cc/blog/archives/2007/10/21/how-to-remotely-turn-on-computer-from-lan-and-wan/

Tuesday, June 08, 2010

how to get LDAP query output of more than 1000 objects

You can always change the LDAP query output from 1000 to the number of your choice on AD using ntdsutil.exe feature. - Caution - this is not the recommended option as this will increase the maxpagefilesize on your server which can be a server performance overload.
===============================

C:\WINDOWS\system32\ntdsutil.exe: ldap policies
ldap policy: connections
server connections: connect to server lab15cust5
Binding to lab15cust5 ...
Connected to lab15cust5 using credentials of locally logged on user.
server connections: q
ldap policy: show values
MaxPageSize 2000
ldap policy: set maxpagesize to 3000
ldap policy: show values
Policy Current(New)
MaxPageSize 2000(3000)
ldap policy: commit changes
ldap policy: show values
Policy Current(New)
MaxPageSize 3000
ldap policy: q

=====================================
Other way of getting more than 1000 results without modifying the maxpagefilesize is by using -E option along with Paged Results option.
ldapsearch -E pr=100/noprompt -H ldap://xxx.xxx.xxx.xxx -x -b "dc=doman,dc=com" -D "domain\username" -W
This will show all the ldap search results even if there is max of 1000 search output results.

Monday, April 26, 2010

process status - Linux

ps auxf -- Will give the processes and child processes information in hierarchical order (grpahically)
ps -p [id]-- Process info based on JobID
ps auU [username] -- All process run by a specific user

Thursday, March 18, 2010

Converstion of second timestamp to date timestamp

Some of the login information is saved on the second time stamp. This will need to be converted into a format that your system can understand.

[root@mail ~]# date;date +%s
Fri Mar 19 10:40:32 IST 2010
1268975432

To convert the second back to IST format

[root@mail ~]# date -d '1970-01-01 1268975432 sec GMT'
Fri Mar 19 10:40:32 IST 2010

[root@mail ~]# date -d@1268975432
Fri Mar 19 10:40:32 IST 2010

=================================

Thursday, March 04, 2010

Setting up of SVN and WebSVN.

Procedure to create a SVN
---------------------------

Package requirement:
================
  • subversion.i386 1.6.5-1 installed
  • subversion-devel.i386 1.6.5-1 installed
  • subversion-perl.i386 1.6.5-1 installed
  • subversion-python.i386 1.6.5-1 installed


Creation of SVN Directory and initialization of SVN
SVN directory location is /srv/svn/repos
  • mkdir /srv/svn/repos
  • svnadmin create --fs-type fsfs /srv/svn/repos
Import the initial code into SVN
  • svn import -m "Initial import" project1 file:///home/project1code
Configure SVN to view changes using WebSVN.

Download a copy of WebSVN on the server
  • http://websvn.tigris.org/servlets/ProjectDocumentList;jsessionid=24F17B3F5279F7DE3BB39F064A2C4A03

Copy the the extracted websvn to /var/www/html/webSVN
  • cp /var/www/html/webSVN/include/distconfig.php to /var/www/html/webSVN/include/config.php
  • modify /var/www/html/webSVN/include/config.php
$config->setDiffPath('/usr/bin/');
$config->setSedPath('/bin/');
$config->setTarPath('/bin/');
$config->setGZipPath('/bin/');
$config->setZipPath('/usr/bin/');
$config->parentPath('/srv/svn/repos'); -------- > Path of your repository
$config->addTemplatePath($locwebsvnreal.'/templates/calm/');
$config->addTemplatePath($locwebsvnreal.'/templates/BlueGrey/');
$config->addTemplatePath($locwebsvnreal.'/templates/Elegant/');
$config->setTemplatePath($locwebsvnreal.'/templates/BlueGrey/');

Now from your web-browser access http://servername/webSVN - this should give you access to your svn thru web interface

Friday, October 30, 2009

vi commands for solaris

Restrict ssh/ftp user from leaving the home directory - Or grant access to specific directory

This script is tested from Bash and Ksh shell.
Edit the user .profile and add the following lines.
################################
typeset -xf _cd
function _cd
{
\cd $*
if grep "${PWD}" /.approved_dirs > /dev/null 2>&1; then
return
fi
\cd $OLDPWD
return
}
alias cd=_cd
####################################
This script will check if the user is trying to do a cd to any other folder other than listed in .approved_dirs. If its listed, it will allow the user to cd to the folder else it will drop the uesr to his old pwd directory. Which is his home directory.
To restrict the user from editing his .profile or .approved_dirs change the permission to 644 for the files.
Pitfall: If the user uses "alias cd=cd" then the above script will not work. Or if th user changes the default shell, the settings will fail. Preferably can be used for sftp user.
This document is picked from the link below - Many thanks to the contributor - I am placing it here so that its easily accessible to me and others refereing my blog for help.

Thursday, October 22, 2009

Wednesday, October 07, 2009

Perl script to create a Exchange Enabled contact on AD

#!/usr/bin/perl

use Net::LDAP;

$Ad = Net::LDAP->new("sogolab.com", version => 3, port => 389) or die("failed $!");
print "Failed connecting" if(!$Ad);

## bind as an admin or someone who has privileges to create an user
$b = $Ad->bind(dn => 'CN=Administrator,CN=Users,DC=sogolab,DC=com', password => 'xxxxxxx') or die("failed $!; ".$b->error);

$result = $Ad->add( 'cn=Thomas T,cn=Users,DC=sogolab,DC=com',
attr => [
'cn' => 'Thomas T',
'sn' => 'Thomas',
'mail' => 'thomas@sogolab.com',
'targetAddress' => 'SMTP:sam@kmail.com',
'mAPIRecipient' => 'FALSE',
'mailNickname' => 'Thomas',
'internetEncoding' => '1310720',
'objectclass' => ['top','person','organizationalPerson','contact' ]]

);

$result->code && warn "failed to add entry: ", $result->error ;

Monday, October 05, 2009

Perl script to create AD User from Unix Server

#!/usr/bin/perl

use Net::LDAP;

$Ad = Net::LDAP->new("sogolab.com", version => 3, port => 389) or die("failed $!");
print "Failed connecting" if(!$Ad);

## bind as an admin or someone who has privileges to create an user
$b = $Ad->bind(dn => 'CN=Administrator,CN=Users,DC=sogolab,DC=com', password => 'XSSSXXX') or die("failed $!; ".$b->error);

$result = $Ad->add( 'cn=Ratish Kumar,cn=Users,DC=sogolab,DC=com',
attr => [
'cn' => 'Ratish Kumar',
'sn' => 'Ratish',
'mail' => 'ratish@kmail.com',
'sAMAccountName' => 'ratish',
'userAccountControl' => '544',
'objectclass' => ['top', 'person','organizationalPerson','user' ]]
);

$result->code && warn "failed to add entry: ", $result->error ;

Thursday, September 24, 2009

Change vsftpd anonymous login default directory

The default anonymous login directory is /var/ftp/
To change the default from /var/ftp to any other directory (say /data)
edit /etc/vsftpd/vsftpd.conf file add entry.
local_root=/data
save the file and restart the vsftpd services using command
services vsftpd restart.

Change the default ftp user account home folder to point to the new location.
before change ftp account info in /etc/passwd file
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
chmod -d /data ftp # To change the home directory for ftp user.
ftp:x:14:50:FTP User:/data:/sbin/nologin
Now when you login as anonymous user, the login directory will be /data.

Saturday, July 04, 2009

http check parameters.

httpd -t - will check the configuration syntax of the http.conf file. - Recommended after any changes to the http.conf file.

httpd -S - Will check and report the virutal machine configuration information.

httpd -l - will list the compiled modules during the installation.

httpd -M - Will show the loaded modules in apache.

httpd -v - Will show the running apache version

httpd -V - will show the exhaustive information about the apache server built.

Monday, June 01, 2009

set http/ftp proxy - Cmd line

For Windows:set http_proxy=http://proxy.example.com:8080
For Linux/Unix:export http_proxy=
http://proxy.example.com:8080
export ftp_proxy=http://proxy.example.com:8080
export http_proxy="http://username:password@proxy.example.com:8080"
–proxy=on
–proxy=off

Thursday, May 07, 2009

Command to collect the HBA details on SUN

On Solaris 9 Use the following commands to collect info.
luxadm -e port
cfgadm -al
prtdiag -v
prtconf -pv grep -i wwn

Solaris 10 Use command.
fcinfo hba-port

Thursday, April 30, 2009

Send Mail from CronJob result mail to users other than root

Mailing Cronjob results to a other users other than root.
0 1 * * 1-6 /location of script mutt -s "Daily Webex Report" email1@email.com,email2@email.com 2>&1

Friday, April 17, 2009

Automatic SFTP to server to get files - Using Expect

#!/usr/bin/expect
set DAY [exec date +%Y-%m-%d]
set timeout -1
spawn /usr/bin/sftp retheesh@3.212.44.46
#spawn sftp retheesh@3.212.44.46
expect "password:";
send "1\r";expect "
sftp>"send "lcd /home/retheesh/sftp/\r"
expect "sftp>"send "cd /home/retheesh/destination/\r"
expect "sftp>"send "mget *$DAY*.csv\r"
expect "sftp>"send "bye\r"
interact

ftp using Shell Script
#!/usr/bin/sh
#DAY=`date +%Y%m%d`
ftp -v -n "3.xxx.xxx.xxx" << cmd
user "anonymous" "test@test.com"
cd retheesh
lcd /root/Ironport/
bin
hash
get filename
quit

Monday, April 13, 2009

Monitor your server using customise OID.
----------------------------------------------
rwcommunity commstring xxx.xxx.xxx.xxx
com2sec local localhost public
com2sec mon_server xxx.xxx.xxx.xxx commstring
##### Second, map the security names into group names:
group MyROSystem v2c mon_server
##### Third, create a view for us to let the groups have rights to:
view all included .1 80
view system included .iso.org.dod.internet.mgmt.mib-2.system
##### Finally, grant the 2 groups access to the 1 view with different
# write permissions:
# context sec.model sec.level match read write notif
access mon_server "" any noauth exact system none none

##CUSTOM OID
exec /bin/sh /location-of-the-script.sh
exec /bin/sh /location-of-the-script1.sh
exec /bin/sh /location-of-the-script2.sh
service snmdp restart

To test the first,second and so on custom script response using snmpwalk client
snmpwalk -v2c -c commstring 1.3.6.1.4.1.2021.8.1.101.1
snmpwalk -v2c -c commstring 1.3.6.1.4.1.2021.8.1.101.2
snmpwalk -v2c -c commstring 1.3.6.1.4.1.2021.8.1.101.3

To collect all the snmp OID parameters.
snmpwalk -v2c -c commstring -O n
OID for HP servers can be found under file /opt/hp/hp-snmp-agents/mibs/cmaobjects.mibdef
Note: HP Proliant Support Pack should be installed.
======
Below given tips are from "http://agiletesting.blogspot.com/2005/10/mini-howto-2-system-monitoring-via.html" Thanks to the wonderful writeup
=====

Document sourced from http://www.debianadmin.com/linux-snmp-oids-for-cpumemory-and-disk-statistics.html

Thank you for sharing


Paritions can be monitored by making parition entries in the /etc/snmp/snmpd.conf file
disk /
disk /boot
disk /usr
snmpwalk -v2c -c "xxxx" .1.3.6.1.4.1.2021.9.1.7.1 ( 1 is for / 2 for /boot and so on)
snmpwalk -v2c -c "xxxx" .1.3.6.1.4.1.2021.9.1.7.2
snmpwalk -v2c -c "xxxx" .1.3.6.1.4.1.2021.9.1.7.3

For monitoring processes make entries in /etc/snmp/snmpd.conf
proc java
proc postmaster
proc mysqld
snmpwalk -v2c -c "xxxx" .1.3.6.1.4.1.2021.2.1.5.1 (1 is for java 2 for postmastet and so on)
snmpwalk -v2c -c "xxxx" .1.3.6.1.4.1.2021.2.1.5.2
snmpwalk -v2c -c "xxxx" .1.3.6.1.4.1.2021.2.1.5.3

For Load Monitoring make following entires in /etc/snmp/snmp.conf file.
load 5 5 5
snmpwalk -v2c -c "xxxx" .1.3.6.1.4.1.2021.10.1.3.1 ( 1 for 1min, 2 for 5min, 3 for 15min usage report)
snmpwalk -v2c -c "xxxx" .1.3.6.1.4.1.2021.10.1.3.2
snmpwalk -v2c -c "xxxx" .1.3.6.1.4.1.2021.10.1.3.3

For various CPU Utilisation Metrics use
snmpwalk -v2c -c "xxxx" .1.3.6.1.4.1.2021.11
For various Memory Utilisation Metrics use
snmpwalk -v2c -c "xxxx" .1.3.6.1.4.1.2021.4

To get the OID from a client.
snmpwalk -v2c -On -c "XXXXX" Servername
This will list all the servers parameter and the OID details.

CPU
percentage of user CPU time: .1.3.6.1.4.1.2021.11.9.0
raw user cpu time: .1.3.6.1.4.1.2021.11.50.0
percentages of system CPU time: .1.3.6.1.4.1.2021.11.10.0
raw system cpu time: .1.3.6.1.4.1.2021.11.52.0
percentages of idle CPU time: .1.3.6.1.4.1.2021.11.11.0
raw idle cpu time: .1.3.6.1.4.1.2021.11.53.0
raw nice cpu time: .1.3.6.1.4.1.2021.11.51.0

Memory Statistics

Total Swap Size: .1.3.6.1.4.1.2021.4.3.0
Available Swap Space: .1.3.6.1.4.1.2021.4.4.0
Total RAM in machine: .1.3.6.1.4.1.2021.4.5.0
Total RAM used: .1.3.6.1.4.1.2021.4.6.0
Total RAM Free: .1.3.6.1.4.1.2021.4.11.0
Total RAM Shared: .1.3.6.1.4.1.2021.4.13.0
Total RAM Buffered: .1.3.6.1.4.1.2021.4.14.0
Total Cached Memory: .1.3.6.1.4.1.2021.4.15.0

Disk Statistics

The snmpd.conf needs to be edited. Add the following (assuming a machine with a single ‘/’ partition):

disk / 100000 (or)

includeAllDisks 10% for all partitions and disks

The OIDs are as follows

Path where the disk is mounted: .1.3.6.1.4.1.2021.9.1.2.1
Path of the device for the partition: .1.3.6.1.4.1.2021.9.1.3.1
Total size of the disk/partion (kBytes): .1.3.6.1.4.1.2021.9.1.6.1
Available space on the disk: .1.3.6.1.4.1.2021.9.1.7.1
Used space on the disk: .1.3.6.1.4.1.2021.9.1.8.1
Percentage of space used on disk: .1.3.6.1.4.1.2021.9.1.9.1
Percentage of inodes used on disk: .1.3.6.1.4.1.2021.9.1.10.1

System Uptime: .1.3.6.1.2.1.1.3.0

Examples

These Commands you need to run on the SNMP server

Get available disk space for / on the target host
#snmpget -v 1 -c “community” target_name_or_ip .1.3.6.1.4.1.2021.9.1.7.1

this will return available disk space for the first entry in the ‘disk’ section of snmpd.conf; replace 1 with n for the nth entry

Get the 1-minute system load on the target host
#snmpget -v 1 -c “community” target_name_or_ip .1.3.6.1.4.1.2021.10.1.3.1

Get the 5-minute system load on the target host
#snmpget -v 1 -c “community” target_name_or_ip .1.3.6.1.4.1.2021.10.1.3.2

Get the 15-minute system load on the target host
#snmpget -v 1 -c “community” target_name_or_ip .1.3.6.1.4.1.2021.10.1.3.3

Get amount of available swap space on the target host
#snmpget -v 1 -c “community” target_name_or_ip .1.3.6.1.4.1.2021.4.4.0

Monday, April 06, 2009

#!/bin/bash################################################################################## Script for parsing IronPort logs for collecting top mail senders every hour on Iron Port Server ################################################################################## #####Collecting the Program Start time##### echo "Program Start time `date +%T`" > /tmp/time ##### Check if the Script is started correctly ##### if [ $# != 1 ]; then echo "Improper syntax" "Expected syntax [script.sh ]"exitelseecho ""fi ##### Setting Variable #####ORG_FILE=$1MAILTO="xssss123@xdwcs.com xssss1234@xdwcs.com"MAIL=/usr/bin/mutt ##### Collecting only required Data from the IronPort Logs ##### grep "interface PublicNet (3\RID [0-9]" $ORG_FILE > /tmp/newreffileSOURCE_FILE=/tmp/newreffile ##### Collecting the HOURS for which the logs to be parsed #####awk '{print $4}' $SOURCE_FILE cut -c 1,2 uniq > /tmp/hrsfileHRSFILE=/tmp/hrsfile ###Collecting data for hour wise ####while read HRSdo grep " $HRS:" $SOURCE_FILE > /tmp/reffileREFFILE=/tmp/reffile DATESTAMP=`head -1 $SOURCE_FILE awk '{print $1,$2,$3}'`TIMESTAMP=`echo $HRS`echo "====================================" > /tmp/masterecho " TOP MAIL SENDERS FOR $DATESTAMP at $HRS" >> /tmp/masterecho "====================================" >> /tmp/master #### Collecting the ICID and IP address details #####grep "(3." $SOURCE_FILE > /tmp/ipfileIPFILE=/tmp/ipfile ################################################# ##### COLLECT ALL UNIQ ICID FROM THE REFERECE FILE #####grep "(3." $REFFILE uniq -u awk '{print $10}'grep '^[0-9]' > /tmp/icidfileICID=/tmp/icidfile while read LINEdo TOTALMAILS=`grep $LINE $SOURCE_FILE grep RID wc -l` IPADDRESS=`grep $LINE $IPFILE grep "(3." awk '{print $15}'` echo -e "$IPADDRESS \t\t $TOTALMAILS" >> /tmp/outputdone < $ICID ##### Collect the Uniq IP address and the mail counts #####awk '{print $1}' /tmp/output sort -u > /tmp/uniqipUNIQ=/tmp/uniqip while read IPdo MCOUNT=`grep $IP /tmp/output awk '{ sum += $2 };END { print sum }'`# echo "$ORG_FILE - HOUR $HRS" > /tmp/result echo -e "$MCOUNT \t \t $IP" >> /tmp/resultdone < $UNIQ RESULT=/tmp/result sort -rn $RESULT head -10 >> /tmp/mastersort -rn $RESULT > /tmp/mailattachment.txtMATTACHMENT=/tmp/mailattachment.txt mv $RESULT $ORG_FILE-`date +%T-%F-%N`echo "Program End time `date +%T`" >> /tmp/timemutt -s "Top 10 Mail Senders" -a $MATTACHMENT $MAILTO < /tmp/mastersleep 10rm -f /tmp/outputdone < $HRSFILE ######### END OF PROGRAM ##############

Tuesday, March 31, 2009

NTP Configuration file.

NTP Configuration,
vi /etc/ntp.conf
restrict default nomodify notrap noquery
restrict 127.0.0.1
server (NTP Server IP/Name)
fudge 127.127.1.0 stratum 10
driftfile /var/lib/ntp/drift
broadcastdelay 0.008
authenticate yes
restrict (NTP Server IP/Name) mask 255.255.255.255 nomodify notrap noquerykeys /etc/ntp/keys

Friday, January 09, 2009

Send SMS to mobile thru email.

to address: countrycodemobilenumer@airtelkk.com (airtelkk stands for Airtel in Karnataka)
subject - short subj.
short - message in body.

and send it away.

Monday, December 29, 2008

HPACUCLI commands

To find HARDWARE RAID and DISK information (For HP servers / Smart Array control card – Need “hpacucli” rpm)+++++++ctrl all showctrl slot=0 showctrl slot=1 logicaldrive all show ctrl slot=1 physicaldrive all show+++++++[root@Server01 root]# hpacucliHP Array Configuration Utility CLI 7.40.7.0Detecting Controllers...Done.Type "help" for a list of supported commands.Type "exit" to close the console.=> ctrl all show
Smart Array 5i in Slot 0 ()
=> ctrl all show status
Smart Array 5i in Slot 0 Controller Status: OK Cache Status: OK
=> ctrl slot=0 show
Controller Smart Array 5i in Slot 0 Bus Interface: pci slot: 0 RAID 6 (ADG) status: False Controller Status: OK Chassis Slot: 1 Hardware Revision: Rev B Firmware Version: 2.58 Rebuild Priority: Low Expand Priority: Low Surface Scan Delay: 15 sec Cache Board Present: True Cache Status: OK Accelerator Ratio: 100/0 (read/write) Read Cache Size: 48 MB Write Cache Size: 0 MB Total Cache Size: 48 MB Battery Backed Cache Size: 0 MB Non Battery Backed Cache Size: 48 MB Battery Pack Count: 0
=> ctrl slot=0 array all show
Smart Array 5i in Slot 0 array A (Parallel SCSI, Unused Space: 0 MB)
=> ctrl slot=0 logicaldrive all show
Smart Array 5i in Slot 0
array A logicaldrive 1 (33.9 GB, 1+0, OK)
=> ctrl slot=0 physicaldrive all show
Smart Array 5i in Slot 0
array A physicaldrive 2:0 (port 2:id 0 , Parallel SCSI, 36.4 GB, OK) physicaldrive 2:1 (port 2:id 1 , Parallel SCSI, 36.4 GB, OK)

---------------

/sbin/hplog -v will show all the Hardware alert logs regarding th HP Server

/sbin/hplog -t -- Display current thermal sensor data

/sbin/hplog -f Display current fan data

/sbin/hplog -p Display current power data

remove blank spaces, tabs and blank lines from file.

tr -d ' \t\n\r' < filename

Thursday, August 28, 2008

Thursday, August 21, 2008

=VLOOKUP(E3,C:C,1,0)

Vlookup for checking the difference between two columns.

E3 is from the column where you want compare.C:C is the entire column where the other set of data is there for comparision.

1,0 - :D no idea.... ---- But it works...

Friday, March 28, 2008

NetBackup Commands

backup Version Details
--------------------------
more /usr/openv/netbackup/bin/version

Media Manager Version
-----------------------
more /usr/openv/volmgr/bin/version

Check the Status of the Tape Drive
----------------------------------
/usr/openv/volmgr/bin/tpconfig -d or -dl
/usr/openv/volmgr/bin/vmoprcmd -d
UP/Down the Tape Library.

-------------------------
/usr/openv/volmgr/bin/vmoprcmd -up 0 #--- UP
/usr/openv/volmgr/bin/vmoprcmd -down 0 #--Down

Check the NetBackup Services.
--------------------------------
/usr/openv/netbackup/bin/bpps -a
Stop / Start the NetBakcup Serivce
-----------------------------------
/usr/openv/netbackup/bin/goodies/K77netbackup #---Kill all the services.
/usr/openv/netbackup/bin/goodies/S77netbackup # ---- Start all the services

Run the Inventory Check on the Tape Library
---------------------------------------------
/usr/openv/volmgr/bin/vmcheckxxx -rt tld -rn 0

Update the Library content to the Scratch Pool (NetBackup)
------------------------------------------
/usr/openv/volmgr/bin/vmupdate -rt tld -rn 0

Netbackup Menu Window for Netbackup operations
-------------------------------------------------
/usr/openv/netbackup/bin/bpadm

Check the Available Media on the Backup server
--------------------------------------
/usr/openv/netbackup/bin/goodies/available_media #---------- From Catalogue
/usr/openv/volmgr/bin/vmquery -rn 0 -bx #-----------From Tape Library.

View the contents of the Tape
------------------------------
/usr/openv/netbackup/bin/admincmd/bpimmedia -L -mediaid R011L1

Expire the Media details from the Catalogue
-----------------------------------------
/usr/openv/netbackup/bin/admincmd/bpexpdate -d 0 -ev R011L1 -force

Delete the contents of a Media
-------------------------------------
/usr/openv/netbackup/bin/admincmd/bplabel -ev R011L1 -d dlt -p NetBackup

List all the Client Backup image List details.
------------------------------------------
/usr/openv/netbackup/bin/admincmd/bpimagelist -U

Freeze a Media
---------------
/usr/openv/netbackup/bin/admincmd/bpmedia -freeze -ev R013L1

Check the Backup Status
--------------------------
/usr/openv/netbackup/bin/admincmd/bpdbjobs -summary
/usr/openv/netbackup/bin/admincmd/bpdbjobs -report #------ Will give more exhaustive information.

Check all the Class files information on Master Server
----------------------------------------------------
/usr/openv/netbackup/bin/admincmd/bpcllist -allclasses -U
/usr/openv/netbackup/bin/admincmd/bpcllist adhoc-gejpfp1_root -U #---------- Individual Class file.

Set the Class file as Active/Inactive
-------------------------------------
/usr/openv/netbackup/bin/admincmd/bpclinfo adhoc-gejpfd1-6206323 -modify -active #-------- Set Active
/usr/openv/netbackup/bin/admincmd/bpclinfo adhoc-gejpfd1-6206323 -modify -inactive # -------- Set Inactive.
Check the Status of the Backup Status. (Get the Active Backup ID from bpdbjobs -report)
--------------------------------------
/usr/openv/netbackup/bin/admincmd/bperror -jobid 13860 -U #----- Take the Job ID from here.
tail -f /usr/openv/netbackup/db/jobs/13870.1206700777.t #------- File will show which file is getting written.

Check the Tape Library Cleaning Status
-------------------------------------
/usr/openv/volmgr/bin/tpclean -L
/usr/openv/netbackup/bin/goodies/cleanstats

Reset the Cleaning Status to Zero
--------------------------------
/usr/openv/volmgr/bin/tpclean -M Drive0

Add Tape to the Clean Tape pool (None)
---------------------------------------
/usr/openv/netbackup/bin/admincmd/bplabel -ev Q949L1 -d dlt_clean -p None

View Rule for Cleaning Tape
------------------------------
/usr/openv/volmgr/bin/vmrule -listall

Add/Remove rule for cleaning Tape.
-----------------------------------
/usr/openv/volmgr/bin/vmrule -add Q949L1 dlt2_clean None 25 "Cleaning Tape"
/usr/openv/volmgr/bin/vmrule -del Q949L1 dlt2_clean None 25 "Cleaning Tape"

Manually Clean the Tape Drive
-----------------------------
/usr/openv/volmgr/bin/tpclean -C Drive0

Thursday, December 20, 2007

Programs

To read lines from a file and echo the line --- (do can be tweaked to match the requirement)
while read myline;do echo $myline; done < inputfile

Tuesday, July 24, 2007

Introduce LMV drives to Linux OS

Introducing LVM drives (storage) to new operating system.
====================================

When lvm drives are introducted to a new operating system. They will not be detected logical volumes.

vgscan - Will detect all the available logical volumes and make necessary enteries in the lvm configuation.

# vgscan Reading all physical volumes. This may take a while... Found volume group "lvm_data3" using metadata type lvm2
Found volume group "lvm_data2" using metadata type lvm2
Found volume group "lvm_data1" using metadata type lvm2

# lvscan
inactive '/dev/lvm_data3/lvm_bkp' [271.00 GB] inherit
inactive '/dev/lvm_data2/lvm_stores' [169.00 GB] inherit
inactive '/dev/lvm_data1/lvm_redo' [60.00 GB] inherit
inactive '/dev/lvm_data1/lvm_log' [30.00 GB] inherit
inactive '/dev/lvm_data1/lvm_conf' [20.00 GB] inherit
inactive '/dev/lvm_data1/lvm_mysql' [50.00 GB] inherit
inactive '/dev/lvm_data1/lvm_index' [25.00 GB] inherit
inactive '/dev/lvm_data1/lvm_lgr' [35.00 GB] inherit

The devices are detected as inactive to make the devices active

vgchange -ay lvm_data3
vgchange -ay lvm_data2
vgchange -ay lvm_data1

lvscan will show all the drives as active.
#lvscan
ACTIVE '/dev/lvm_data3/lvm_bkp' [271.00 GB] inherit
ACTIVE '/dev/lvm_data2/lvm_stores' [169.00 GB] inherit
ACTIVE '/dev/lvm_data1/lvm_redo' [60.00 GB] inherit
ACTIVE '/dev/lvm_data1/lvm_log' [30.00 GB] inherit
ACTIVE '/dev/lvm_data1/lvm_conf' [20.00 GB] inherit
ACTIVE '/dev/lvm_data1/lvm_mysql' [50.00 GB] inherit
ACTIVE '/dev/lvm_data1/lvm_index' [25.00 GB] inherit
ACTIVE '/dev/lvm_data1/lvm_lgr' [35.00 GB] inherit

you should be able to mount the filesystem now

Friday, June 29, 2007

commands

1. List the files in current directory sorted by size ? - ls -l grep ^- sort -nr
2. List the hidden files in current directory ? - ls -a1 grep "^\."
3. Delete blank lines in a file ? - cat sample.txt grep -v ‘^$’ > new_sample.txt
4. Search for a sample string in particular files ? - grep “Debug” *.confHere grep uses the string “Debug” to search in all files with extension“.conf” under current directory.
5. Display the last newly appending lines of a file during appendingdata to the same file by some processes ? - tail –f Debug.logHere tail shows the newly appended data into Debug.log by some processes/user.
6. Display the Disk Usage of file sizes under each directory in currentDirectory ? - du -k * sort –nr (or) du –k . sort -nr
7. Change to a directory, which is having very long name ? - cd CDMA_3X_GEN*Here original directory name is – “CDMA_3X_GENERATION_DATA”.
8. Display the top most process utilizing most CPU ? - top –b 1
9. Set the Display automatically for the current new user ? - export DISPLAY=`eval ‘who am i cut -d"(" -f2 cut -d")" -f1′`Here in above command, see single quote, double quote, grave ascent is used. Observe carefully.
10. Display the processes, which are running under yourusername ? - ps –aef grep MaheshvjHere, Maheshvj is the username.
11. List some Hot Keys for bash shell ? - Ctrl+l – Clears the Screen. Ctrl+r – Does a search in previously given commands in shell. Ctrl+u - Clears the typing before the hotkey. Ctrl+a – Places cursor at the beginning of the command at shell. Ctrl+e – Places cursor at the end of the command at shell. Ctrl+d – Kills the shell. Ctrl+z – Places the currently running process into background.
12. Display the files in the directory by file size ? - ls –ltr sort –nr –k 5
13. How to save man pages to a file ? - man col –b > Example : man top col –b > top_help.txt
14. How to know the date & time for – when script is executed ? - Add the following script line in shell script.eval echo "Script is executed at `date`" >> timeinfo.infHere, “timeinfo.inf” contains date & time details ie., when script is executed and history related to execution.
15. How do you find out drive statistics ? - iostat -E
16. Display disk usage in Kilobytes ? - du -k
17. Display top ten largest files/directories ? - du -sk * sort -nr head
18. How much space is used for users in kilobytes ? - quot -af
19. How to create null file ? - cat /dev/null > filename1
20. Access common commands quicker ? - ps -ef grep -i $@
21. Display the page size of memory ? - pagesize -a
22. Display Ethernet Address arp table ? - arp -a
23. Display the no.of active established connections to localhost ? - netstat -a grep EST
24. Display the state of interfaces used for TCP/IP traffice ? - netstat -i
25. Display the parent/child tree of a process ? - ptree Example: ptree 1267
26. Show the working directory of a process ? - pwdx Example: pwdx 1267
27. Display the processes current open files ? - pfiles Example: pfiles 1267
28. Display the inter-process communication facility status ? - ipcs
29. Alternative for top command ? - prstat -a
30. Run grep for multiple strings? - grep "string1\string2"
31 search multiple strings on the same line egrep 'string1.*string2' filename
32. how to remove to values from using sed - sed 's/value1\value2//g'

Sed
----
change value in a file recursively and display ? - sed 's/oldvalue/newvalue/g' filename
Remove a special character from file eg; "/" - sed -e 's,/,,g' Test - Change the delimiter to ","
Use underscore ( _) as a paramter when you are trying to search and replace anything that involves front/backslash - This avoids the delimiter and the front slash confussion
Eg: To change /usr/sbin/test to /var/log/test in a file
1. sed 's_/usr/sbin/test_/var/log/test_g' file > file-new
2. sed -s '/startline/,/endline/p' filename -- This will collect all the lines between startline and endline including both startline and endline.
3. sed -n 5p -- Will print the line5 from the file. - To read a particular line from a file
4. awk NR==5 -- -- Will print the line5 from the file. - To read a particular line from a file
5. cat output| awk '{FS=" " ; $0=$0 ; print $NF"|"$0}' | sort -rn | cut -d"|" -f2 |head -15 -- Sort file based on the last field with irregular number of fields

5. From line
open("/lib64/librt.so.1", O_RDONLY) = 3
----------------
$sed -n 5p ls.output |
sed 's/.*.1//g'
", O_RDONLY) = 3
# Will show everything after .1 from the above line
------------------
$sed -n 5p ls.output |
sed 's/1.*//g'
open("/lib64/librt.so.
# Will show everything before 1 as output

Good Link for SED - http://www.grymoire.com/Unix/Sed.html
Another very good link for sed http://sed.sourceforge.net/sed1line.txt

find
----
Display the all files recursively - find . -depth -print
Search file recursively - find /home/david -name 'index*'
Search file recursively (Case insensitive) -find /home/david -iname 'index*'
find /mp3collection -name '*.mp3' -size -5000k
$ find / -size +10000k
ind /home/david -amin -10 -name '*.c'
$ find /home/david -atime -2 -name '*.c'
$ find /home/david -mmin -10 -name '*.c'
$ find /home/david -mtime -2 -name '*.c'
ind /mp3-collection -name 'Metal*' -and -size +10000k
$ find /mp3-collection -size +10000k ! -name "Metal*"
$ find /mp3-collection -name 'Metal*' -or -size +10000k

Cut
----
Cut output from the line to get all usernames from the file - Eg.filename.txt
/kolab/var/imapd/spool/domain/m/sample.domain/s/user/suresh/Calendar/1.
/kolab/var/imapd/spool/domain/m/sample.domain/s/user/sathish/Calendar/11.

cat filename.txt cut -d/ -f11
Explaination - This will set "/" as delimiter and gives field 11 - suresh and sathish as output


Track command history based on time
export HISTTIMEFORMAT="%x %X " in .bashrc of shell

Command to extract contents from an RPM file
rpm2cpio cpio -ivd

Command to view the contents of an RPM file
rpm -qpil /path/to/the/rpmfile

Wednesday, June 27, 2007

SysStat Installation & configuration

Check whether the rpm is installed.
#rpm -qa grep -i sysstat

If sysstat is not installed install it
#rpm -ivh sysstat-5.0.5-5.rhel3.i386.rpm

Modify /etc/cron.d/systat :
# run system activity accounting tool every 1 minute i.e collect 2 sample/min with 30 sec interval.
*/1 * * * * root /usr/lib/sa/sa1 30 2

Note : Comment the existing entry which collects data every 10 min ( 1 sample/10 min) # */10 * * * * root /usr/lib/sa/sa1 1 1

Restart crond service.# service crond restart

To get CPU utilization information :
# sar -f /var/log/sa/sadd -u more
where dd represents day of the month.

To get memory utilization output :# sar -f /var/log/sa/sadd -r more
Where dd represents day of the month.

Wednesday, December 06, 2006

cool codes........


Open any of your fav site. paste this on the url location and hit enter


java-script:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.images ; DIL=DI.length; function A(){for(i=0;

Monday, November 13, 2006

Telnet to pop3 and Smtp.

Using telnet to check if the SMTP and pop3 service is running on a server.

TELNET.
=======
Telnet - SMTP Commands (sending mail using telnet)
In order to access your mailbox you will need 3 things:
An active internet connection (an embarrasing stage to miss sometimes!)
The address of a mail server capable of relaying for you - usually provided by your dialup provider (e.g. mail.domain.ext)
A valid email address (e.g. mail@domain.ext)
The first thing to do is to open a connection from your computer to your mail server.
telnet mail.domain.ext 25
You should receive a reply like:
Trying ???.???.???.???...
Connected to mail.domain.ext.
Escape character is '^]'.
220 mail.domain.ext ESMTP Sendmail ?version-number?; ?date+time+gmtoffset?

You will then need to delcare where you are sending the email from:
HELO local.domain.name
Dont worry too much about your local domain name although you really should use your exact fully qualified domain name as seen by the outside world the mail server has no choice but to take your word for it as of RFC822-RFC1123.
This should give you:
250 mail.domain.ext Hello local.domain.name [loc.al.i.p], pleased to meet you

Now give your email address:
MAIL FROM: mail@domain.ext
Should yeild:
250 2.1.0 mail@domain.ext... Sender ok
If it doesn't please see possible problems.

Now give the recipients address:
RCPT TO: mail@otherdomain.ext
Should yeild:
250 2.1.0 mail@otherdomain.ext... Recipient ok
If it doesn't please see possible problems.

To start composing the message issue the command
DATA

If you want a subject for your email type Subject:-type subject here- then press enter twice (these are needed to conform to RFC 882)

You may now proceed to type the body of your message (e.g. hello mail@otherdomain.ext from mail@domain.ext)

To tell the mail server that you have completed the message enter a single "." on a line on it's own.
The mail server should reply with: 250 2.0.0 ???????? Message accepted for delivery

You can close the connection by issuing the QUIT command.
The mailserver should reply with something like:221 2.0.0 mail.domain.ext closing connection
Connection closed by foreign host.



Here are a list of problems I've encountered and their fixes
501 nouser@nosuchplace.here... Sender domain must exist
The domain that you are sending from must exist

503 Need MAIL before RCPT
A recipient has been specified before a sender.

550 mail@domain.ext... Relaying Denied
The mail server has refused to relay mail for you, this may be for any number of reasons but typical resons include:
Not using this provider for an internet connection and/or
Not using an email address provided by the owner of the server.

Some things to watch out for:
1. If you type too quickly, sometimes it won't recognise your text (weird!)
2. The backspace key sometimes does not work with some telnet clients (even though it may seem as though it does)

I'll be putting more as and when I get them and figure out how to fix each problem.

POP3
====
Telnet - POP Commands (retrieving mail using telnet)
In order to access your mailbox you will need 4 things:
An active internet connection (an embarrasing stage to miss sometimes!)
The address of your pop mail server (e.g. mail.domain.ext)
Your username (e.g. userName)
Your password (e.g. passW0rd)
The first thing to do is to open a connection from your computer to your mail server.
telnet mail.domain.ext 110You should receive a reply like:
Trying ???.???.???.???...
Connected to mail.domain.ext.
Escape character is '^]'.
+OK ready

Then log in:
USER userName
This should give you:
+OK Password required for userName.

Now give your password:
PASS passW0rd
Should yeild:
+OK userName has ? visible messages (? hidden) in ????? octets.
If it doesn't please see possible problems.

To see a list of your emails awaiting collection use the LIST command, this will also show you the id number of your messages (e.g. 1 or 2 etc.)
To view the contents of an email type RETR + the id number of the message (e.g RETR 1).
To delete a message use DELE + the id number of the message (e.g DELE 1).
To leave your mailbox and close the connection use QUIT

Here are a list of problems I've encountered and their fixes
-ERR [AUTH] Password supplied for "userName" is incorrect.
The password supplied was not the one expected by the server, retype the password, failing that find out if you've got the correct password.

-ERR [AUTH] PAM authentication failed for user "userName": Authentication failure (7)
Your mailbox could not be broken down into seperate emails correctly, there may be a remnant of a message left - Ask your ISP to edit the mailbox manually and look for free lines above the headers.

452 4.4.5 Insufficient disk space; try again later
The mailserver cannot write the temporary files needed to allow you to collect your mail - ask your ISP to check disk useage and allocation on the server

-ERR [SYS/TEMP] Unable to copy mail spool file, quota exceeded (122)
The mailserver cannot create a temporary file needed to allow you access to your mailbox as you've run out of your space allocation - Try to reduce the amount of disk space you are using on that server (this quota may be shared between your mail, web and userspace), alternatively contact your ISP to increase your quota.

-ERR [IN-USE] /???/???/.userName.pop lock busy! Is another session active? (11)
The mailbox is currently in use by another connection or an old connection has terminated uncleanly - This will deal with itself

Overquota locking file '/???/???/???/userName.lock'; lock proceeding anyway


Unable to process From lines (envelopes) in /???/???/???/userName; change recognition mode or check for corrupted mail drop.
The mailbox cannot be split into seperate messages because the pop server cannot recognise distinct boundaries or the boundaries do not include the whole mailbox

Some things to watch out for:
1. If you type too quickly, sometimes it won't recognise your text (weird!)
2. The backspace key sometimes does not work with some telnet clients (even though it may seem as though it does)

I'll be putting more as and when I get them and figure out how to fix each problem.

You can find the document on using this URL. http://www.yuki-onna.co.uk/email/

Monday, November 06, 2006

Shreya - My Neice photographs. [Click here]

Retrieving Hardware Information on linux

Retrieving Hardware Information
If you need information on system's hardware like vendor, manufacturer, product, S/N, etc. you can use:

dmidecode
lshw
hwbrowser (graphical)
sysreport - Will collect all hardware information

The dmidecode command reads the information from the system BIOS, see also http://www.nongnu.org/dmidecode/.

There are a few other commands you might want to check out which list installed hardware components etc.:

lsdev
lshal
lspci
lsusb
lsscsi

Starting with the 2.6 kernel you can now get lots of information from /sys. For example, to get information on an Emulex HBA:

# ls /sys/class/scsi_host/host1/

board_mode lpfc_cr_delay lpfc_poll option_rom_version
board_online lpfc_drvr_version lpfc_poll_tmo portnum
cmd_per_lun lpfc_fcp_class lpfc_scan_down proc_name
ctlreg lpfc_fdmi_on lpfc_topology programtype
device lpfc_hba_queue_depth lpfc_use_adisc scan
fwrev lpfc_link_speed management_version serialnum
hdw lpfc_log_verbose mbox sg_tablesize
host_busy lpfc_lun_queue_depth modeldesc state
info lpfc_max_luns modelname uevent
lpfc_ack0 lpfc_multi_ring_support nport_evt_cnt unchecked_isa_dma
lpfc_cr_count lpfc_nodev_tmo num_discovered_ports unique_id
#

Friday, October 20, 2006

Nandhi Hills Trip - Photographs [Click Here]

Nandhi Hill Trip - with Microland Colleagues.
Anand and Jayaprakash's treat....

Dated : 14th October 2006

Unix - VCS - VxFS - Shell commands - Many more tips [Click Here]

Unix - All the Informations for a Unix System Administrator

Tuesday, October 10, 2006

Cool lines...

# A diplomatic husband said to his wife, "How do you expect me to remember your birthday when you never look any older?"
# A clean tie attracts the soup of the day.
# A cigarette is a pinch of tobacco, wrapped in paper, fire at one end, fool at the other
# A baby sitter is a teenager acting like an adult while the adults are out acting like teenagers.
# A dog thinks: Hey, these people I live with feed me, love me, provide me with a nice warm, dry house, pet me, and take good care of me... They must be Gods!
A cat thinks: Hey, these people I live with feed me, love me, provide me with a nice warm, dry house, pet me, and take good care of me... I must be a God!
# A dream is just a dream. A goal is a dream with a plan and a deadline.
# A drop of ink may make a million think.
# A fair face may fade, but a beautiful soul last forever.
# A Dutchman was explaining the red, white, and blue Netherlands flag to an American.
"Our flag is symbolic of our taxes.
We get red when we talk about them, white when we get our tax bills, and blue after we pay them."
The American nodded. "It's the same in the USA only we see stars too!"

Tuesday, June 27, 2006

Linux Snippets.

Linux command tips ******
http://www.pixelbeat.org/cmdline.html


http://www.felixgers.de/teaching/emacs/vi_search_replace.html

Vi: Search and Replace
Change to normal mode with .

Search (Wraped around at end of file):

Search STRING forward : / STRING.
Search STRING backward: ? STRING.

Repeat search: n
Repeat search in opposite direction: N (SHIFT-n)

Replace: Same as with sed, Replace OLD with NEW:

First occurrence on current line: :s/OLD/NEW
Globally (all) on current line: :s/OLD/NEW/g
Between two lines #,#: :#,#s/OLD/NEW/g
Every occurrence in file: :%s/OLD/NEW/g
Command for commenting out N number of lines (N = number of lines) :.,+N s/^/#/g
-----------------------------------
awk and sed commands

file test.txt content is retheesh kumar R
to view kumar R use
#cat test.txtawk '{print $2 $3}'

or you can use sed command and remove retheesh
#cat test.txtsed 's/retheesh//'
this switches retheesh with blank //

vi +5 filename.txt # This will open the filename.txt with the cursor on the 5th line
vi +$ filename.txt # This will open the filename.txt with the cursor on the last line

=========================
Edit Multiple files at one go.
==========================

vi file1 file2 file3
Will open file1
:wnext to move to file2 by saving changes to file1
:next! to move to file2 without saving changes on file1

To move to previous file
:wprevious - To move to previous file by saving changes to the current.
:previous! - To move to pervious file without saving changes to the current

To see the list of file that is being edit and to know the current edite
:args

========================================
Viewing mulitple file on the same vim window
======================================

To split multiple files for easy editing. (Horizontal Split)
vim fileone #original file from the original file type
:split /path/to/filetwo # Another file
Will open up 2 different files you can toggle between both the files using CTRL + W
To save changes type
:wclose - Will save changes to the file
:close! - Will exit without any changes

To split multiple files for easy editing. (Vertical Split)
im fileone #original file from the original file type
:vsplit /path/to/filetwo # Another file
Will open up 2 different files you can toggle between both the files using CTRL + W
To save changes type
:wclose - Will save changes to the file
:close! - Will exit without any changes

================================
New file from existing vim window
===============================
Creat a new txt file from vi console
:new - Will create a new file for edition
Note while saving ensure to use :w filename to save the file
======================
Command to manually set date on the redhat system.

#date -s "MM/DD/yyyy hh:mm:ss"
Example -
#date -s "03/17/2006 02:01:39"
-----------------------------------
For better graphical display during bootup and on command line mode edit grub and
add " rhgb quite vga=0x317"

eg: kernel /vmlinuz-2.6.9-5.EL ro root=LABEL=/ rhgb quiet vga=0x317
---------------------------------

Procedure to register and up2date your machine.

#cat /etc/redhat-release -----------> will show the redhat version you are using

up2date-nox --config
httpProxy :
enableProxy Yes

#up2date-nox -l
This will connect to the server using the proxy details mentioned, and sent the server details to the rhn.redhat.com site. (tab systems).
#run the rpm -keyXXSSXXSSSS
execute command to start updating the packages to the latest
#up2date-nox -u -----------> will start updating all the packages with the latest packages available on redhat site.

Using up2date command to update kernel.
Note: Kernel update will not actually upgrade the kernel but install a new version of kernel and make relevent entries on the /etc/grub.conf file and set the boot parameter to boot with the new kernel.
#up2date-nox -f kernel -----------> either enter kernel* or manually give all the kernel-smp, kernel-Highmem etc to install.

#cat /etc/redhat-release -----------> will show the updated redhat version
--------------------------------------

mke2fs -j -b 4096 / will specifiy 4KB blocksize, this will help in faster fsck.


Saturday, June 24, 2006

bonding network card on linux.

1. Add entires on /etc/module.conf file
alias bond0 bonding
options bond0 miimon=100 mode=1
--------------------------------------
2. lsmod should detect module.
bonding 25220 1
-------------------------------------
3. cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
BROADCAST=3.159.19.255
IPADDR=3.159.17.80
NETMASK=255.255.252.0
NETWORK=3.159.16.0
ONBOOT=yes

cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
TYPE=Ethernet
MASTER=bond0
SLAVE=yes
ETHTOOL_OPTS="autoneg off speed 100 duplex full"

cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
TYPE=Ethernet
ONBOOT=no

cat /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
BOOTPROTO=static
ONBOOT=yes
TYPE=Ethernet
MASTER=bond0
SLAVE=yes
ETHTOOL_OPTS="autoneg off speed 100 duplex full"

cat /etc/sysconfig/network-scripts/ifcfg-eth3
DEVICE=eth3
BOOTPROTO=static
TYPE=Ethernet
ONBOOT=no
==========================================

Wednesday, June 21, 2006

Enable full duplex and disabling autonegotiation for nic cards,

Modifying network settings

Add the following line in
/etc/sysconfig/network-scripts/ifconfig-eth0 &
/etc/sysconfig/network-scripts/ifconfig-eth2

ETHTOOL_OPTS="autoneg off speed 100 duplex full"

Restart network service
#service network restart

This will set network settings to full duplex, Speed: 100Mb/s & auto-negotiation: No

Run following commands to confirm network settings
#ethtool eth0
#ethtool eth1

Saturday, June 10, 2006

Words.. The ever Lasting Words.

Words without thought are dead sounds; thoughts without words are nothing.
To think is to speak low; to speak is to think aloud.
--Max Muller

It is with words as with sunbeams, the more they are condensed, the deeper they burn.
--Southey

Words are things; and a small drop of ink, falling like dew upon a
thought, produces that which makes thousands, perhaps millions, think.
--Byron