To Gain Knowledge and to become a one, who all wants to become

Dreams are not those which are seen during sleep ,but Dreams are those which do not let you sleep,so see the dreams
and work hard to make them true.

Wednesday, May 11, 2011

Postfix Flush the Mail Queue

Postfix Flush the Mail Queue


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</usr/sbin/postqueue -p>;
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

Wednesday, October 27, 2010

Adding Recapcha in Joomla


Download the Recapcha plugin from here : http://www.unixmen.com/joomla-tutorials/776-howto-integrate-recaptcha-antispam-in-joomla-contact-and-registration-form-

1. Login to Joomla Administration --> Extensions--> Install/Uninstall

2. Upload the package file and Click on "Upload Fle and Install"

3. Go to Plugin Manager and it will be shown as System - JEZ ReCaptcha, publish it
    and then click on it .

4 .It will open the setting for JEZ ReCapcha plugin ,do the following .
* Enabled : yes
reCAPTCHA Public :
reCAPTCHA Private :
Inclusion Syntax : No
Auto-verify : Yes

Note : The reptcha public and private key has to be generated by signing  into you google accounts /

https://admin.recaptcha.net/recaptcha/sites/



--
Regards
---
Rachit Seth

Monday, October 25, 2010

How to recover VM on Xenserver When VM is not bootable from updated kernel (Citrics XenServer )


1 . Create/Restore an new VM (say rescue vm )on the xenserver where the crashed VM is located.

2 . Stop the  rescue  vm and deattach the storage device .

3 . Attach this storage  device on crashed vm .

4 . Change the crashed disk vbd to non bootable after checking with below command

    xe vm-disk-list vm="crashedvm name" l ( It will list the storage devices with their uuid's ,for each disk there is a vdi and vbd uuid )

  xe vbd-param-set uuid=7f6a1563-fc76-31d8-49c2-c03466ca836b bootable=false

5 . Change the rescue vm disk vbd  to bootable .

  xe vbd-param-set uuid=5f64a143633-fc76-313-59a2-d13466ca3egf bootable=true

6  Start the crashed vm ,it will boot with the rescue vm's disk.
    Now ,mount the  original disk  whose vbd you  changed to non bootable earlier .

    mount /dev/xvda /mnt

7 . Going  to /mnt ,we will get the old filesystem.
     cd /mnt/boot/

    Changed the grub.conf default  entry   to 1 i.e the older version of kernel is selected( as i have updated the
    kernel after which vm  does not starts)

8. Stop the this crash vm again .

9 . Deattach  the rescue disk from the crashed vm and change the crashed disk's vbd again to bootable .
     
       xe vbd-param-set uuid=7f6a1563-fc76-31d8-49c2-c03466ca836b bootable=true.

10 .Now try to start it  and now it is  bootable (from earlier  kernel.)