Listing Domains Managed on a Plesk Server

Posted in Plesk on December 19th, 2008 by dave

I’ve learned the hard way that while directly altering Plesk’s database is almost never a good idea, the Plesk database ‘PSA’ holds a ton of useful information that’s not always readily exportable from the interface. Here are a couple of useful queries. The first simply exports a list of “standard hosted” domains. The second includes client information.

You’ll need to be logged in as root.

First, Get into MySQL and use the Plesk database, “psa”:

mysql -u admin -p`cat /etc/psa/.psa.shadow`;
use psa;

Query 1: List all the standard hosted domains, send the results to a csv file:

select name from domains where htype='vrt_hst' INTO OUTFILE '/tmp/domains.csv';

Query 2: Building on that, lets add client information and sort it to make it pretty:

select cname,name from domains, clients where cl_id = clients.id and htype='vrt_hst' order by cname,name INTO OUTFILE '/tmp/domains-client.csv';

Nothing earth shattering here, but it might save you 5 minutes.

Managing Orphaned Parallels Plesk Mailboxes

Posted in Plesk on September 11th, 2008 by dave

Intro

Over the past few months I began to notice a steady erosion in available disk space on a server running the Parallels’ Plesk control panel. After some sleuthing I tracked it down to the management of mailboxes in combination with the “Mail Forward” and “Mail Group” functions on domains the “Mailbox quota” set to unlimited.

There are two basic issues:

  1. Users setup ‘redirects’ or ‘mail group’ functions and leave the account mailbox enabled, then never check the mailbox and delete the messages.  (e.g. sales@somedomain.com forwards to bill@somedomain.com and jim@gmail.com, but nobody logs on to sales@ and deletes the message)
  2. Disabling the mailbox does not delete the existing files in the mailbox.  All those mail files will just hang around forever, orphaned from the control panel.
Slogging around in the qmail directories looking for files is no fun.  Here’s how I rid myself of these pesky disk-eaters.  I took a two pronged approach:
  • Query the Plesk database to identify mail accounts with mailboxes that redirect.
  • Query the filesystem to find Mailbox directories that are large.

Query the Plesk Database

You’ll need shell access to your server.  Login to your server, pop into mysql and use the Plesk database (PSA) using the following command:

mysql -u admin -p`cat /etc/psa/.psa.shadow`;
use psa;

Use the following query to select mailboxes that redirect:


select name,mail_name,redir_addr from mail, domains where mail.dom_id = domains.id and postbox = 'true' and redirect = 'true';

Now you’ve got some ammunition. Exit out of mysql.

 

Finding Big Mailboxes

A ‘mailbox’ in qmail is simply a directory. Each undelivered message is a file in that directory. On my  installation of Plesk qmail  is installed in ‘/var/qmail/’ The mailbox for ‘jimbo@somedomain.com’ takes the form: ‘/var/qmail/somedomain.com/jimbo/Maildir/new’.

The command below uses ‘du’ to grab the size of all the directories in mailnames, grep filters out all but the ‘Maildir/new’ directory leaving us with a list of all our mailboxes and their size. Running them through sort in the manner shown orders them biggest to smallest. Just the way we want ‘em.

Log in as root and run the following:


du /var/qmail/mailnames | grep 'Maildir/new' | sort -rnk1 > mboxsize.txt

Sample Output:

1047680 /var/qmail/mailnames/somedomain.com/karyon/Maildir/new
123820 /var/qmail/mailnames/somedomain.com/vickih/Maildir/new
94156 /var/qmail/mailnames/somedomain.com/info/Maildir/new
88368 /var/qmail/mailnames/somedomain.com/kathyh/Maildir/new

Delete those Suckers

Armed with all the mailboxes that forward and a list of the big offenders you wouldn’t think this would need much explanation, but after several weeks or months of collecting files you may find you have to many files in the directory to delete with a simple “rm * -f”. Apparently there are limits to the number of files you can delete at one time with a wildcard.

If you run into difficulties with rm give this a shot:

CD to the directory and run ‘ls -al’. Note that the name of your server is a string common to all files, replace MYSERVER below with the common string:

find . -name '*MYSERVER*' | xargs rm

In your gusto to clean things out remember that there are legitimate reasons to keep a mailbox turned on for forwarded accounts, (The boss may want to be able to review mail sent to sales@ to make sure that leads are being followed up on, etc.) and some users may just get incredible amounts of mail. With that in mind this should help you keep a lid on things. Once you’ve got things cleaned out you may be able to use quotas to help the problem from repeating.

Wow, Gmail is down - 502 bad gateway.

Posted in Random Tech on August 11th, 2008 by dave
Gmail Down - 502 error message

Gmail Down - 502 error message

Well, it looks like I really can’t blame this on a flaky WIFI connection at the coffee shop. Gmail is returning a 502 error. In other words, gmail is down. Looks like I’m not the only one. There’s some chatter HERE on google groups.

So, what exactly causes a 502 error?  The folks at checkupdown.com have a nice explanation here.  They suggest cleaning out your browser cache, but it looks like this is beyond that.  We’ve tried from an ISP in NY and one in the Midwest.  If you’re not logged in to your account it will authenticate you.  The error occurs after authentication.  Curious.

Update - Looks like they’ve excercised their demons (or restarted their daemons).  After almost an hour gmail is back.

Installing OpenBlueDragon in Five Minutes - Screencast

Posted in OpenBlueDragon on July 16th, 2008 by dave

The OpenBlueDragon site says “Open BlueDragon, is the worlds favourite open source GPL J2EE CFML runtime engine…Available to download today as a standard Java J2EE WAR file, or completely pre-configured JETTY server, VMWare/Amazon image, you can be up and running within minutes.

The British spelling of “favourite” might indicate that OpenBlueDragon has made a jump across the pond and may be on it’s way to world dominance, so I decided to see if indeed I could be up and running in minutes. I was.

I’m familiar with WAR files, VMWare images and setting up Amazon EC2 virtual machines with ElasticFox, but I’d never even heard of JETTY. After a few minutes of Google to resolve fears that JETTY would somehow destroy my local Apache install I dove in.

It couldn’t have been easier. Basically you unzip the file, type in a run command at the command prompt and your up and running. Take a look at the screencast below and dive in.

Next up: Drive Mappings and Data Sources.

 
icon for podpress  Test Podcast: Play Now | Play in Popup | Download

OpenBlueDragon is here. Woot!

Posted in OpenBlueDragon on July 15th, 2008 by dave

OpenBlueDragon, “the worlds favourite GPL open source J2EE CFML runtime engine” is out and available at OpenBlueDragon.org. This is a fantastic addition to the open source world.

For the last eight years I’ve built three companies and made a good living developing coldfusion applications. We’ve all watched as the product and our destiny passed from Allaire to Macromedia to Adobe. ColdFusion books bloomed on the shelves of Borders and Barnes and Noble only to disappear into Amazon. I’ve cycled through Ruby and PHP and loathed .Net and at the end of the day, I can *STILL* get more out the door with CFML than I can with anything else. Now we can finally take the bull by the horns.

There are, of course other Non-Adobe CFML projects, but OpenBlueDragon seems to have what it takes to carry the day. We’ve been waiting for this for some time, and are planning to port our condoEngine application from Win2k / IIS / CFMX 6.1 / SqlServer setup to Linux / OpenBlueDragon / MySql, or Firebird… We plan to document our little adventure on this blog.

We’re also working on getting OpenBlueDragon working on or Parrallels - Plesk based hosting platforms. Plesk currently has both ColdFusion and Tomcat integrated into the control panel. There are a lot of small hosting companies - and some large ones - using Plesk. Getting OpenBlueDragon running on Plesk servers may help introduce many new users to the project.

We’ll keep posting…