Welcome to my page. I am not an avid writer, but i am trying. Here you will find some of the fine snippets i came across which i would like to revisit given a chance. Some of the technical troublshooting which i encountered, which i would like to maintain here as ready reckoner. Please feel free to go around my pages. Bouquets and Brickbats are welcomed. :-)
Tuesday, November 23, 2010
Tuesday, November 02, 2010
XOR operation for Parity Caluclation
Sample XOR operation that will be used for recovering data during parity regeneration
A | B | C | ||
0 | XOR | 0 | -> | 0 |
0 | XOR | 1 | -> | 1 |
1 | XOR | 0 | -> | 1 |
1 | XOR | 1 | -> | 0 |
Tuesday, October 26, 2010
Get date information from commands.
Get the Date output.
===============
$ date +%d -- Date
26
$ date +%D -- Date format
10/26/10
$ date +%m -- Month
10
$ date +%b -- Month
Oct
$ date +%M -- Minutes
45
$ date +%W -- Week of the year
43
$ date +%w -- Week of the day
2
$ date +%Y -- Year
2010
$ date +%y -- Year (last 2 digits)
10
$ date +%n -- New line
$ date +%l -- hour (0..12)
4
$ date +%k -- hour (0..23)
16
$ date +%N -- nano seconds
855022663
$ date +%T -- time format
16:48:14
-----------------------------------
$ set `date`
$ echo $1
Tue
$ echo $2
Oct
$ echo $3
26
$ echo $4
16:52:45
$ echo $5
IST
$ echo $6
2010
$ echo $# -- Total number of command variables.
6
-----------------------------------------------
date |cut -d" " -f1 # Replace f1 to f2,3,4,5,6 to get the values.
Tue
-------------------------
You can run a loop to check the day and run some commands according using case loop.
case `date |cut -d" " -f1` in
Mon) commands ;;
Tue) commands ;;
Wed) commands ;;
...
esac
===============
$ date +%d -- Date
26
$ date +%D -- Date format
10/26/10
$ date +%m -- Month
10
$ date +%b -- Month
Oct
$ date +%M -- Minutes
45
$ date +%W -- Week of the year
43
$ date +%w -- Week of the day
2
$ date +%Y -- Year
2010
$ date +%y -- Year (last 2 digits)
10
$ date +%n -- New line
$ date +%l -- hour (0..12)
4
$ date +%k -- hour (0..23)
16
$ date +%N -- nano seconds
855022663
$ date +%T -- time format
16:48:14
-----------------------------------
$ set `date`
$ echo $1
Tue
$ echo $2
Oct
$ echo $3
26
$ echo $4
16:52:45
$ echo $5
IST
$ echo $6
2010
$ echo $# -- Total number of command variables.
6
-----------------------------------------------
date |cut -d" " -f1 # Replace f1 to f2,3,4,5,6 to get the values.
Tue
-------------------------
You can run a loop to check the day and run some commands according using case loop.
case `date |cut -d" " -f1` in
Mon) commands ;;
Tue) commands ;;
Wed) commands ;;
...
esac
Monday, October 25, 2010
Check top CPU or Memory utilisation process.
Find Processes that uses maximum processor utilisation
#ps -eo pid,ppid,pcpu,rss,cmd --sort pcpu
Find Processes that uses maximum Memory utilisation
#ps -eo pid,ppid,pcpu,rss,cmd --sort rss
#ps -eo pid,ppid,pcpu,rss,cmd --sort pcpu
Find Processes that uses maximum Memory utilisation
#ps -eo pid,ppid,pcpu,rss,cmd --sort rss
Kill multiple jobs OR Kill all jobs of a particular user
# Create a list of specific jobs of a user
ps -ef |grep [username]|grep [jobname eg. telnet]|awk '{print $2}' > /tmp/fileout
while read userpid; do kill -9 $userpid;done < /tmp/fileout
ps -ef |grep [username]|grep [jobname eg. telnet]|awk '{print $2}' > /tmp/fileout
while read userpid; do kill -9 $userpid;done < /tmp/fileout
Wednesday, September 08, 2010
Modify FreeNas configuration file
Editing of FreeNAS configure file is not possible from the FreeNAS shell.
To modify the configuration - Eg., /etc/fstab on FreeNAS
share /etc directory using NFS / CIFS share - ( Make sure its not a read only share)
mount /etc share on linux partition.
Use vi tool to modify the configuration file and save the configuration.
:) done.
To modify the configuration - Eg., /etc/fstab on FreeNAS
share /etc directory using NFS / CIFS share - ( Make sure its not a read only share)
mount /etc share on linux partition.
Use vi tool to modify the configuration file and save the configuration.
:) done.
Tuesday, September 07, 2010
perl module checks & installation
[root@mail ~]# instmodsh
Available commands are:
l - List all installed modules
m - Select a module
q - Quit the program
perldoc perllocal - Will display all additional modules that were installed.
perldoc perlmodlib - Will display all modules that are installed along with the standard perl packagesperldoc perllocal - Will display all additional modules that were installed.
-----------------------
To install perl modules - (Make sure your system is connected to internet)
perl -MCPAN -e shell
cpan> o conf - will display the configurations
cpan> o conf init - Will reinitiate the configuration.
cpan> install Bundle::cpan --- Sample command to install modules.
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
/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
=========
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)
-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/
http://www.raymond.cc/blog/archives/2007/10/21/how-to-remotely-turn-on-computer-from-lan-and-wan/
Thursday, June 10, 2010
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.
===============================
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
ps -p
ps auU
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
=================================
[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:
================
Creation of SVN Directory and initialization of SVN
SVN directory location is /srv/svn/repos
Download a copy of WebSVN on the server
Copy the the extracted websvn to /var/www/html/webSVN
$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
---------------------------
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
svn import -m "Initial import" project1 file:///home/project1code
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->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
Subscribe to:
Posts (Atom)