Thursday, September 30, 2010

Compare two mail addresses

#!/usr/bin/perl
use DBI;
%MYSQL = (
hostname => "localhost",
username => "root",
password => "",
database => "asterisk"
);

my $sender= 'abc@onvi.com';
$sender=$ARGV[0];
$sender=~ s/@/\@/;# replace @ with \2 in mail address

# connect to DB
my $dbh = DBI->connect("dbi:mysql:$MYSQL{database}:$MYSQL{hostname}","$MYSQL{username}","$MYSQL{password}");

my $qry = "SELECT * FROM test;";
#print $qry."\n";
my $result = $dbh->prepare($qry);
$result->execute();
my $tmp='';

# write to file
while (@row = $result->fetchrow()) {
$tmp=@row[1]; # assign mail addres to $tmp variable
$tmp=~ s/@/\@/; # replace @ with \2 in mail address

#print $sender." <---> ".$tmp."\n";

if($tmp eq $sender){
print $tmp."==".$sender."\n";
}


#print @row[0]."-->".$tmp."\n";
}#while

Wednesday, September 15, 2010

date command in GNU/Linux

  • date +%s
    can use to create random unique file names.

VIM

  • Install vim
    yum -y install vim-X11 vim-common vim-enhanced vim-minimal

Sendmail - Postfix

The sendmail compatible mail sending path in postfix.
This is a interface.

/usr/sbin/sendmail.postfix

Monday, September 13, 2010

Installing Perl Modules

Commands

  • #perl -e 'use MIME::Parser'
    To check weather the package is install or not.

  • #perl -c /path/to/file.pl
    To check compilation errors in perl file

Saturday, September 11, 2010

mutt install and send mail

  • #yum install mutt
  • mutt -s "Test mail" -a /path/to/attachment receiver@domain < /path/to/body/text

Monday, September 6, 2010

Dialog eZ reload

How to send reload to Dialog mobile from another Dialog mobile.
  • Type following text in message.
    eZ Amount Dialog_Mobile_No 1234
  • Send message to 356.

Reload inittab file

  1. init q - relaod inittab

Changing the hostname on CentOS

teChanging the hostname on CentOS: "If the hostname setting is incorrect on your CentOS/RedHat/Fedora machine, it's really easy to change the hostname from the command line. There are also GUI tools for doing this but we'll just look at the CLI tools for doing this."

Friday, September 3, 2010

sendmail commands

  1. makemap hash /etc/mail/filename < /etc/mail/filename

CentOS Commands

The shell command in CentOS.
  1. cat /proc/cpuinfo
    Shows, cpu information

  2. netstat -ntl
    shows, Active Internet connections (only servers).

Wednesday, September 1, 2010

Postfix Commands


  1. # postfix reload
    When you change the parameters in main.cf or master.cf.

  2. #netstat -na | grep 25
    Show status of port 25