Thursday, March 29, 2012

Postfix Flush the Mail Queue

Postfix Flush the Mail Queue

by Vivek Gite on October 25, 2007 · 20 comments
Traditionally you use the "sendmail -q" command to flush mail queue under Sendmail MTA. Under Postfix MTA, just enter the following command to flush the mail queue:
# postfix flush
OR
# postfix -f
To see mail queue, enter:
# mailq
To remove all mail from the queue, enter:
# postsuper -d ALL
To remove all mails in the deferred queue, enter:
# postsuper -d ALL deferred

postfix-delete.pl script

Following script deletes all mail from the mailq which matches the regular expression specified as the first argument (Credit: ??? - I found it on old good newsgroup)
#!/usr/bin/perl
 
$REGEXP = shift || die "no email-adress given (regexp-style, e.g. bl.*\@yahoo.com)!";
 
@data = qx;
for (@data) {
  if (/^(\w+)(\*|\!)?\s/) {
     $queue_id = $1;
  }
  if($queue_id) {
    if (/$REGEXP/i) {
      $Q{$queue_id} = 1;
      $queue_id = "";
    }
  }
}
 
#open(POSTSUPER,"|cat") || die "couldn't open postsuper" ;
open(POSTSUPER,"|postsuper -d -") || die "couldn't open postsuper" ;
 
foreach (keys %Q) {
  print POSTSUPER "$_\n";
};
close(POSTSUPER);
 
For example, delete all queued messages from or to the domain called fackspamdomain.com, enter:
./postfix-delete.pl fackspamdomain.com
Delete all queued messages that contain the word "xyz" in the e-mail address:
./postfix-delete.pl xyz
Updated for accuracy.






Use the following command to view the current postfix MTA queue:
# postqueue -p

Tuesday, March 27, 2012

Install unrar command

Install unrar command

Under Debian or Ubuntu Linux, you need to type apt-get command as follows to install unrar program:
# apt-get install unrar
If you are using Fedora core Linux / CentOS / RHEL, use yum command as follows (see discussion below for more):
# yum install unrar
If you are using FreeBSD, enter:
# pkg_add -v -r unrar
If any of above, methods is not working for you, download binary package from official rarlab site:
$ cd /tmp
$ wget http://www.rarlab.com/rar/rarlinux-3.6.0.tar.gz

Next, untar file, enter:
$ tar -zxvf rarlinux-3.6.0.tar.gz
Both unrar and rar commands are located in rar sub-directory. Just cd to rar directory, type:
$ cd rar
$ ./unrar

Now copy rar and unrar file to /bin directory, type:
# cp rar unrar /bin

HowTo: Use unrar Command

The unrar command supports various options, below are common options that you need to for extracting files.

Task: Exreact rar (unpack) File

To extract file.rar file into the current directory, enter:
$ unrar e file.rar

Task: List (l) file inside rar archive:

$ unrar l file.rar

Task: To extract (x) files with full path type command:

$ unrar x file.rar
(D) To test (t) integrity of archive, file type command:
$ unrar t file.rar

Rewrite Rule to redirect the access for a IP to another URL.

 Rewrite Rule to redirect the access for a IP to another URL.

#RewriteEngine on
#RewriteCond %{REMOTE_ADDR} ^172\.16\.107 [OR]
#RewriteCond %{REMOTE_ADDR} 172.16.107.58
#RewriteCond %{REMOTE_ADDR} 172.16.110.35
#RewriteRule /node/64$ https://xxxxxxxxxxxxx.com/node/65 [R=301,L]

Thursday, March 22, 2012

libMagickCore.so.5: cannot open shared object file:

libMagickCore.so.5: cannot open shared object file:

======================
ldconfig /usr/local/lib
 ======================

Monday, March 19, 2012

About Incron

Install incron

Type the following command under RHEL / Fedora / CentOS Linux:
$ sudo yum install incron
Type the following command under Debian / Ubuntu Linux:
$ sudo apt-get install incron

Configuration Files

  • /etc/incron.conf - Main incron configuration file
  • /etc/incron.d/ - This directory is examined by incrond for system table files. You should put all your config file here as per directory or domain names.
  • /etc/incron.allow - This file contains users allowed to use incron.
  • /etc/incron.deny - This file contains users denied to use incron.
  • /var/spool/incron - This directory is examined by incrond for user table files which is set by users running the incrontab command.

incron Syntax

The syntax is as follows:
    options
/var/www/html IN_CREATE /root/scripts/backup.sh
/sales IN_DELETE /root/scripts/sync.sh
/var/named/chroot/var/master IN_CREATE,IN_ATTRIB,IN_MODIFY /sbin/rndc reload
Where,
  • - It is nothing but path which is an absolute filesystem path such as /home/data. Any changes made to this path will result into command or action.
  • - Mask is is nothing but various file system events such as deleting a file. Each event can result into command execution. Use the following masks:
    • IN_ACCESS - File was accessed (read)
    • IN_ATTRIB - Metadata changed (permissions, timestamps, extended attributes, etc.)
    • IN_CLOSE_WRITE - File opened for writing was closed
    • IN_CLOSE_NOWRITE - File not opened for writing was closed
    • IN_CREATE - File/directory created in watched directory
    • IN_DELETE - File/directory deleted from watched directory
    • IN_DELETE_SELF - Watched file/directory was itself deleted
    • IN_MODIFY - File was modified
    • IN_MOVE_SELF - Watched file/directory was itself moved
    • IN_MOVED_FROM - File moved out of watched directory
    • IN_MOVED_TO - File moved into watched directory
    • IN_OPEN - File was opened
    • The IN_ALL_EVENTS symbol is defined as a bit mask of all of the above events.
  • - Run command or scripts when mask matched on given directory.
  • options - It can be any one of the following with command (i.e. you can pass it as arg to your command):
    1. $$ - dollar sign
    2. $@ - watched filesystem path (see above)
    3. $# - event-related file name
    4. $% - event flags (textually)
    5. $& - event flags (numerically)

Turn Service On

Type the following command:
# service incrond start
# chkconfig incrond on

Examples:

Type the following command to edit your incrontab
incrontab -e
Run logger command when file created or deleted from /tmp directory:
/tmp IN_ALL_EVENTS logger "/tmp action for $# file"
Save and close the file. Now cd to /tmp and create a file:
$ cd /tmp
$ >foo
$ rm foo

Friday, March 2, 2012

How to install Kaltura CE V4.0 on Centos

Install the required packages



Add 2 repos

## Remi Dependency on CentOS and Red Hat (RHEL)

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm



yum install httpd php php-cli curl php-gd mysql-server mysql php-mysql php-xml

yum install php-devel zlib-devel

Install Memcached package:

yum install memcached

yum –enablerepo=remi install memcached

# Set Memcached to start automatically on boot

chkconfig memcached on

# Start Memcached

/etc/init.d/memcached start

## OR ##

service memcached start

Install teh php modules

yum install php php-pecl-memcache

yum install php php-pecl-memcached

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

Verify that the following settings within the php.ini file

For PHP 5.3: Verify that request_order parameter includes C, G and P (recommended: “CGP”)

For PHP 5.2: Verify that variables_order parameter in php.ini includes C, G and P

/etc/php.ini and the / searched for variables_order as I had php 5.2 and set time zone "Asia/calcutta" if ur usinh php5.3

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

Add this to /etc/my.cnf, ensure it in the mysqld section.

lower_case_table_names=1

thread_stack=262144

open_files_limit=20000

Then restart mysql

service mysqld restart

=======

install the pentaho data integration package

mkdir /usr/local/pentaho

cd /usr/local/pentaho

wget http://sourceforge.net/projects/pentaho/files/Data%20Integration/3.2.0-stable/pdi-ce-3.2.0-stable.tar.gz/download

tar xvfz pdi-ce-3.2.0-stable.tar.gz -C /usr/local/pentaho

mv data-integration pdi

==========

Disable SELinux (if installed)

vi /etc/sysconfig/selinux

SELINUX=disabled

===

Get Kaltura

cd /usr/src/

register in http://www.kaltura.org/ and wget community edition kaltura.v4

=====

Now run the install.php and following the instructions.

apachectl path

php path

mysql user ;- root

mysql password ;- root password/blank

Once installation has completed follow the final instructions of adding your host to the /etc/hosts file and updating your httpd.conf to include kaltura config.

You need to create start scripts for the search daemon and batch manager, so

cd /etc/init.d/
ln -s /opt/kaltura/app/scripts/searchd.sh kaltura-searchd
ln -s /opt/kaltura/app/scripts/serviceBatchMgr.sh kaltura-serviceBatchMgr


should start these proceess
=================================================

Configure Canvas

In a web browser, go to http://kalturadev.example.com/start/

    Click on Admin Console (right image) and log in.
    Click Add New Publisher sub-tab under Publishers tab and add the new user.
    On Publisher Management page, select Manage in the Action dropdown menu for the new Publisher. This will log you in to the management console as that publisher.
    Click the Settings tab at the top.
    Click the Integration Settings sub-tab.

Copy the two IDs and Secret keys to the canvas/config/kaltura.yml file settings as follows:

Partner ID => partner_id
Sub Partner ID => subpartner_id
Administrator Secret => secret_key
User Secret => user_secret_key

    Click on Studio tab.

Select one of these players or add a new one, and copy the ID number for it to the canvas/config/kaltura.yml file for the player_ui_conf and upload_ui_conf values (I was told upload_ui_conf doesn’t matter yet, so not sure what should go here).

To get the kcw_ui_conf value, you need to log into the mysql db on the kaltura server:

> mysql -u root -p
mysql> use kaltura;
mysql> select * from ui_conf where obj_type=2;

Pick one of these (such as “default KCW for KMC”) and copy the “id” number to canvas/config/kaltura.yml for the kcw_ui_conf value.

Set the remaining canvas/config/kaltura.yml settings while here:

domain: kaltura server url (no http://)
resource_domain: same as above

Restart Canvas Apache and Canvas_init.