{"id":6074,"date":"2016-07-27T08:39:23","date_gmt":"2016-07-27T00:39:23","guid":{"rendered":"http:\/\/rmohan.com\/?p=6074"},"modified":"2016-07-27T08:39:23","modified_gmt":"2016-07-27T00:39:23","slug":"how-to-clear-the-qmail-queue","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6074","title":{"rendered":"How to clear the Qmail Queue"},"content":{"rendered":"<p>Clear &#038; Clean Qmail Queue Completely, Safely &#038; Fast!<\/p>\n<p>This script should not remove anything it should not remove, and it should clear all e-mail from your qmail queue safely so you can start sending mail normally again. (This is for qmail only and not a solution for any other mail programs.) You\u2019re going to need ssh access and an ssh program like putty or putty portable.<\/p>\n<p>Let\u2019s get busy with the Qmail Clear script:<\/p>\n<p>    Log into your server through ssh<br \/>\n    type this:<br \/>\n    su \u2013<br \/>\n    type this:<br \/>\n    wget http:\/\/www.howtohacks.com\/scripts\/qmailclear.sh<br \/>\n    type this:<br \/>\n    sh qmailclear.sh or sh .\/qmailclear.sh<br \/>\n    done.<\/p>\n<p>You can download it and view it yourself, but just as a quick summary so you know what it\u2019s doing, the Qmail Clear script looks like this:<\/p>\n<p>    echo Cleaning Queue<br \/>\n    mv \/var\/qmail\/queue\/lock \/root\/<br \/>\n    cd \/var\/qmail\/queue; find . -type f -exec rm -f \u2018{}\u2019 \\;<br \/>\n    mv \/root\/lock \/var\/qmail\/queue\/<br \/>\n    echo Queue is now Clean<\/p>\n<p>If this didn\u2019t do the trick and you\u2019re receiving oversized file truncating errors (or \u201cArgument list too long\u201d) then you should use this more intense script. It will take longer but it will get the job done.<\/p>\n<p>Let\u2019s get busy with the Qmail Clean script :<\/p>\n<p>    Log into your server through ssh<br \/>\n    type this:<br \/>\n    su \u2013<br \/>\n    type this:<br \/>\n    wget http:\/\/www.howtohacks.com\/scripts\/qmailclean.sh<br \/>\n    type this:<br \/>\n    sh qmailclean.sh or sh .\/qmailclean.sh<br \/>\n    done.<\/p>\n<p>DO NOT restart any process. DO NOT reboot the server. DO NOT do anything until the script says it is done. If you restart a process, etc, it will break qmail and that\u2019s no fun. Just run the script until it\u2019s complete.<\/p>\n<p>You can download the script and view all of the code yourself, but here\u2019s a quick summary of the main lines of code so you know what\u2019s taking place when running the Qmail Clean script:<\/p>\n<p>    echo \u201cStopping Qmail\u201d<br \/>\n    \/etc\/init.d\/qmail stop<br \/>\n    echo \u201cClearing the Mail Queue\u201d<br \/>\n    cd \/var\/qmail\/queue\/info<br \/>\n    rm -rf blah blah blah<br \/>\n    echo \u201cInfo folder clean, clearing mess folder\u201d<br \/>\n    cd \/var\/qmail\/queue\/mess<br \/>\n    rm -rf blah blah blah<br \/>\n    echo \u201cMess folder clean, clearing remote folder\u201d<br \/>\n    cd \/var\/qmail\/queue\/remote<br \/>\n    rm -rf blah blah blah<br \/>\n    echo \u201cRemote folder clean, clearing intd folder\u201d<br \/>\n    cd \/var\/qmail\/queue\/intd<br \/>\n    rm -rf blah blah blah<br \/>\n    echo \u201cIntd folder clean, clearing local folder\u201d<br \/>\n    cd \/var\/qmail\/queue\/local<br \/>\n    rm -rf blah blah blah<br \/>\n    echo \u201cLocal folder clean, clearing todo folder\u201d<br \/>\n    cd \/var\/qmail\/queue\/todo<br \/>\n    rm -rf blah blah blah<br \/>\n    echo \u201cMail queue cleaned\u201d<br \/>\n    echo \u201cRestarting Qmail Now\u201d<br \/>\n    \/etc\/init.d\/qmail start<br \/>\n    echo \u201cQmail Started!\u201d<br \/>\n    echo \u201cDone!\u201d<\/p>\n<p>If you\u2019re interested in reading more about Qmail I recommend this book Qmail book and also these links:<br \/>\nA reference for qmail users \u2013 qmail.org<br \/>\nA qmail tutorial site \u2013 Life With Qmail<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Clear &#038; Clean Qmail Queue Completely, Safely &#038; Fast!<\/p>\n<p>This script should not remove anything it should not remove, and it should clear all e-mail from your qmail queue safely so you can start sending mail normally again. (This is for qmail only and not a solution for any other mail programs.) You\u2019re going to [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6074"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6074"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6074\/revisions"}],"predecessor-version":[{"id":6075,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6074\/revisions\/6075"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6074"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6074"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6074"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}