Categories
Plesk

Quick command : Top 25 Mailboxes by Size

Description : This command will email (or display in terminal) the top 25 mailboxes, ordered by size. Strangely – Plesk doesn’t seem to have any kind of Mailbox Size report, and will only show you the domain mailboxes combined.

Simply SSH into your Plesk server and run the following :

cd /var/qmail/mailnames
du -hs --block-size=1024K */* | sort -nr | head -25 | mail -s 'Top 25 Mailboxes by Size' [email protected]

And if you wish to display on screen :

cd /var/qmail/mailnames
du -hs --block-size=1024K */* | sort -nr | head -25

The first script could be set up as a handy Cron job to send you a weekly / monthly report.

Categories
Linux Plesk

MySQL Database issues – Plesk CP and websites

Tonight I found that our Plesk server had got itself into a state where Domains could not be Activated/Suspended, and websites with Databases were not loading correctly (eg WordPress sites etc), errors were as follows :

Website Logs:

WordPress database error Got error 28 from storage engine for query…

Plesk Control Panel Error:

Unable to activate/deactivate domain: Domain Mgmt backend failed: domainmng: /usr/local/psa/admin/bin/ftpmng execution failed:

Looking at the file system (see below), the TMP directory was full so MySQL will have been unable to create any temp tables etc.

df -h
Filesystem            Size  Used Avail Use% Mounted on

/dev/md1         9.2G  354M  8.4G   4% /
/dev/md5         9.4G  1.7G  7.7G  18% /usr
/dev/md6         213G   15G  199G   7% /var
none             990M  988M  1.8M 100% /tmp
tmpfs            990M     0  990M   0% /usr/local/psa/handlers/before-local
tmpfs            990M     0  990M   0% /usr/local/psa/handlers/before-queue
tmpfs            990M     0  990M   0% /usr/local/psa/handlers/before-remote
tmpfs            990M  5.1M  985M   1% /usr/local/psa/handlers/info
tmpfs            990M     0  990M   0% /usr/local/psa/handlers/spool

In my case, TMP was running at 100% and was filled by file : “repo_transport_tmp_HcQKVt” The temp file was a server backup file which was being downloaded to the local repository. After removing the file, ran the following command to restart MySQL

/etc/rc.d/init.d/mysqld restart
Categories
Backup Windows

Attix5 and Backup Exec conflicts

We have encountered some issues with clients who already use Symantec Backup Exec and are adding additional off-site backups using Attix5. The problem is caused by both Attix5 and Symante BE using the same listening port (Port 10000) to talk to the backup agents. It seems that the Attix5 dominates the battle, and Backup Exec will then fail with the error :

Completed status: Failed
Final error: 0xe000846b – The resource could not be backed up because an error occurred while connecting to the Backup Exec for Windows Servers Remote Agent.
Make sure that the Remote Agent is installed on the target computer and is running.

??To get around this error, you can change the Attix5 listening port by following these instructions :

  1. Stop the ‘Attix5 Professional’ service within ‘Control Panel’ – ‘Administrative Tools’ – ‘Services’.
  2. Right click the Attix5 icon in the system tray and select ‘Exit’.
  3. Close any instances of Attix5 that are running.
  4. Browse to the Attix5 installation directory (by default C:\Program Files\Attix5 Professional\) through Windows Explorer.
  5. Make a backup copy of the ‘a5backup.properties’ file and store it somewhere safe.
  6. Open the original copy of the ‘a5backup.properties’ file and add the following entry at the bottom of the file, ensuring that there are no trailing spaces or carriage returns:-
    service.port=10001

    Close the file and save the change.

  7. Start the ‘ Attix5 Professional’ service and open Attix5 Professional.
  8. To confirm that the change has worked, execute the following command from a command prompt:-
    netstat -anb | more
  9. You should see an entry similar to the following:-
    TCP � �127.0.0.1:10001 � �� 0.0.0.0:0� � � �� LISTENING � � � 160
    [a5backup.exe]
  10. If the port shows as ‘10001’, the change has been successful.
Categories
HowTo Guides Windows

Converting Outlook 2003/2007 nk2 file to Outlook 2010

Today I had an old Windows 2000 client PC  with Outlook 2003, which was being replaced by Windows 7 and Outlook 2010. Out of courtesy (and for an easy life!) I try to make the migration as seamless as possible, which includes taking along recently typed email addresses within Outlook.

Normally this is simply a case of copying the Outlook.nk2 file which is stored within C:\Documents and Settings\Username\Application Data\Microsoft\Outlook\ accross to the new PC – however, this doesn’t work with Outlook 2010. The Outlook 2010 NK2 file is actually a DAT file and is located, on the above operating systems, at C:\Users\{username}\AppData\Local\Microsoft\Outlook\RoamCache\Stream_Autocomplete_y_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.dat (y = file index, x = random 16-byte key in hex form).

I found the following article cleared this up, and provide a simply “FixItForMe” tool, which providing that you put the old NK2 file in the normal location C:\Users\Username\AppData\Roaming\Microsoft\Outlook – the tool will take care of the conversion for you! Easy…

http://support.microsoft.com/kb/980542

Direct Link to FitIt tool : http://go.microsoft.com/?linkid=9758283

Categories
Windows Server

Closing terminal server sessions remotely

I had another occasion today where “The terminal server has exceeded the maximum number of allowed connections” due to abandoned sessions and was unable to remotely gain access to a server using Terminal Services because both sessions are used up. I can use another server to check the status of the first one, or in my case I can connect into a client computer remotely. As long as the logged in user has administrative rights on the non-accessible machine I would run this:

qwinsta /server:12.12.12.12

Where 12.12.12.12 is the IP address or name of the non-accessible machine.

This will display something like this:

> qwinsta /server:12.12.12.12
SESSIONNAME USERNAME ID STATE TYPE DEVICE
console 0 Conn wdcon
rdp-tcp 65536 Listen rdpwd
rdp-tcp#470 Bob 1 Active rdpwd
rdp-tcp#471 Jane 3 Active rdpwd

Now I know that Bob and Jane are the two that are logged in. Since Jane left the office 20 minutes ago I know that she forgot to log off. I don’t know where Bob is but I only need one session so I’ll ignore him for now.

To disconnect Jane’s session (number 3 as shown above) I would type this:

rwinsta /server:12.12.12.12 3

Strange names?. This came from the Citrix Metaframe days which Terminal Services has descended from. It stands for:

qwinsta = Query WINdows STAtion
rwinsta = Reset WINdows STAtion

Categories
Linux Plesk

New database user error “Table ‘mysql.servers’ doesn’t exist”

Had an issue reported today when a user created a new SQL Database, and then a new user. On creation of the new user in the Plesk control panel – they received the error “Table ‘mysql.servers’ doesn’t exist”.

mysql_fix_privilege_tables --user=admin --password= --verbose 

After running, the below output was generated