Sunday, January 29, 2012

ERROR: Error installing sqlite3-ruby:

ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension. /usr/bin/ruby1.8 extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... no
checking for sqlite3_initialize()... no
sqlite3-ruby only supports sqlite3 versions 3.6.16+, please upgrade!
* extconf.rb failed *
============================

$ wget http://www.sqlite.org/sqlite-amalgamation-3.7.0.1.tar.gz
$ tar xvzf sqlite-amalgamation-3.7.0.1.tar.gz
$ cd sqlite-3.7.0.1
$ ./configure --prefix=/opt/local/sqlite-3.7.0.1
$ make
$ sudo make install
$ sudo /opt/ruby-enterprise-1.8.7-2010.02/bin/gem install sqlite3-ruby -- --with-sqlite3-dir=/opt/local/sqlite-3.7.0.1 
Building native extensions.  This could take a while...
Successfully installed sqlite3-ruby-1.3.1
1 gem installed
 
=================
 
Using bundler 
============

./configure prefix=$HOME
make && make install

Go to application Path
bundle config build.sqlite3-ruby “--with-sqlite3-include=$HOME/include --with-sqlite3-lib=$HOME/lib 
 
bundle install --path vendor/bundle 

Friday, January 27, 2012

The fastest way to kill tcp or udp port is to run the following command:

The fastest way to kill tcp or udp port is to run the following command:

fuser -k PORT-NUMBER-HERE/tcp
fuser -k PORT-NUMBER-HERE/udp

Tuesday, January 24, 2012

Script to check if jobs is running and start it, if its not running.

Script to check if  jobs is running and start it, if its not running.


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

===========
COUNT=`ps -ef | grep "jobs:work" |grep -v grep | wc -l`
     
  /usr/local/bin/bundle exec rake  --trace

else
        echo "JOB IS RUNNING" &> /dev/null
fi
                                                      
===========

Convert a unix file to dos

vi 1.txt
:set ff=dos

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

To unix

vi 1.txt
:set ff=unix
==============

To unix
dos2unix 11

To dos
unix2dos 11
==============

Monday, January 16, 2012

Script

multiple variables  from file
 while read -r a b; do  ./iu-copy  -S imap.rediffmailpro.com/$b/$a -D 127.0.0.1/$b/$a ; done < emerg >> emerg.log 2>&1
 
 
cat 1|cut -d"." -f3-4 -- to cut last three and four octet of IP

awk '{n=split($0,A,".");S=A[n];{for(i=n-1;i>0;i--)S=S"."A[i]}}END{print S}'  to reverse print the IP  
 
find  /home/raji/inbound/ -type f|egrep -iv Archive|xargs -i mv -f "{}" 
/home/raju/inbound/Archive/"  #To Archive the file to Archive directory 
 from ftp server end
 
 
echo "techmed-VM38.secure.redaid.com_mysql_hot_backup_2012091205.xbstream.gpg" | sed 's/.gpg//'
 
 
 
mount
 
mount |column -t  
=============
 
 Simple script to list all active and system users.

------------------------[cut]------------------
#!/bin/bash
_l="/etc/login.defs"
...
 
 
 
To remove all gems 
 
'gem list | cut -d" " -f1 | xargs gem uninstall -aIx'


Pass yes/no reply for overwriting

yes n|cp -i   ====== no for overwriting
yes y|cp -i   ======  for overwriting
To removal ALL the files and not any subdirectories in /dest type the following
find /dest -type f -delete

To removal only the files and ot any subdirectories in /dest type the following:

find /dest -maxdepth 1 -type f -delete
Script to copy files for Particular date

ls -ali |grep -i Aug | grep -i 2011 |awk {'print $10'}|xargs -I '{}' mv {} /home/sanoj/123

Replace

replace 'dest word' 'source word' -- file.txt

Find and Copy file.

find . -name02022_201201140501042684. -exec cp {} /123/ \;

Saturday, January 14, 2012

cannot open shared object file: No such file or directory

libMagickCore.so.2: cannot open shared object file: No such file or directory – /usr/lib/ruby/gems/1.8/gems/rmagick-2.8.0/lib/RMagick2.so

 ==============
To get rid of this error i executed
ldconfig /usr/local/lib
 ============== 

Monday, January 9, 2012

How to SARG on Centos | Fedora | RedHat

http://sourceforge.net/projects/sarg/files/sarg/sarg-2.3.1/sarg-2.3.1.tar.gz/download
# tar -zxvf sarg-2.3.1.tar.gz
# cd sarg-2.3.1/
# ./configure
# make 

# make install
=========================================================
Main sarg configuration file: /usr/local/etc/sarg.conf


# vim /usr/local/etc/sarg.conf
# This is sample configuration, that you need to setup

access_log /var/log/squid/access.log
graphs yes
graph_days_bytes_bar_color orange
title “Squid User Access Reports”
temporary_dir /tmp
output_dir /var/www/html/reports/

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


# vi /etc/httpd/conf.d/sarg.conf
Alias /sarg /var/www/html/reports/daily

DirectoryIndex index.html

===========================================================
vim sarglog.sh
#!/bin/bash
#Get current date
TODAY=$(date +%d/%m/%Y)

#Get one week ago today
YESTERDAY=$(date –date “1 day ago” +%d/%m/%Y)

/usr/local/bin/sarg -l /var/log/squid/access.log -o /var/www/html/reports/daily -z -d $YESTERDAY-$TODAY
exit 0

============================================================
# crontab -e
00 01 * * * /root/sarglog.sh
============================================================

Tuesday, January 3, 2012

Can't install RMagick 2.13.1. Can't find MagickWand.h.

To fix this issue

===
 ln -s /usr/local/include/ImageMagick/wand /usr/local/include/wand
ln -s /usr/local/include/ImageMagick/magick /usr/local/include/magick
===

Sunday, January 1, 2012

Monitoring LSI RAID adapter with mpt-status

Monitoring LSI RAID adapter with mpt-status
Download and install the mpt-status utility:
# wget http://www.drugphish.ch/~ratz/mpt-status/RPMS/1.2.0_RC7/mpt-status-1.2.0_RC7-3.i386.rpm
# rpm -ivh mpt-status-1.2.0_RC7-3.i386.rpm
So far, so good. But running the mpt-status led into some error messages:
# mpt-status
open /dev/mptctl: No such file or directory
Try: mknod /dev/mptctl c 10 220
Make sure mptctl is loaded into the kernel
Ok, there are two errors, first I solved the first error:
# mknod /dev/mptctl c 10 220
Let’s try again to run the mpt-status utility:
# mpt-status
open /dev/mptctl: No such device
Are you sure your controller is supported by mptlinux?
Make sure mptctl is loaded into the kernel
One of the error messages disappeared, but still, it is not working. Now you have to load the mptctl module:
# modprobe mptctl
Try again to run the mpt-status utility, you will see it will work. Enjoy!

PDF to TIFF coversion using ImageMagik


Install Ghost Script
 ==================
wget http://downloads.ghostscript.com/public/ghostscript-9.02.tar.gz
tar -xzf ghostscript-9.02.tar.gz
cd ghostscript-9.02
./configure --help
./configure --with-system-libtiff
make
make instal
 ===================
 cd ImageMagick-6.7.4-0
 ./configure --enable-shared --with-jpeg=yes --with-png=yes --with-tiff=yes --with-xml=yes --with-gslib
 make
 make install
 identify -list format
=====================

convert -define quantum:polarity=min-is-white  -endian MSB  -units PixelsPerInch -density 204x196 -monochrome   -compress Fax   -sample 1728 "input.pdf" "output.tif"
=====================