Categories
Linux Plesk

Plesk Prelink Cron error

I found that we had been getting this error every morning since updating the Plesk server to 9.3 :

Cron <root@plesk3> run-parts /etc/cron.daily
/etc/cron.daily/prelink:
/etc/cron.daily/prelink: line 45: /var/log/prelink/prelink.log: No such file or directory
/etc/cron.daily/prelink: line 46: /var/log/prelink/prelink.log: No such file or directory
/etc/cron.daily/prelink: line 47: /var/log/prelink/prelink.log: No such file or directory

The odd thing is that the /var/log/prelink/ folder does not seem to have been created during the upgrade process, and the cron cannot create the folder automatically. Simple fix – SSH into your server and create the folder manually

mkdir /var/log/prelink

Let me know in the comments if this has helped you out…

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
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

Categories
Linux Plesk

Plesk server – ‘www’ prefix not working

If you didn’t add the ‘www’ prefix at the time of setting up the domain, even adding it back in later doesn’t seem to work. This fault seems to be present within all current versions of Plesk up to my current version v9.2

To work around this problem, firstly – turn on the ‘www’ prefix again within the Plesk control panel.

Domains > yourdomain.com > Modify > WWW Prefix – Tick this box

The www prefix will still not work… to correct this, we need to re-build the Apache config after turning it back on:

/usr/local/psa/admin/sbin/websrvmng -v -a
Categories
Linux Plesk

Lookup client passwords on Plesk

1. Connect to the Plesk Database

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

2. Select one of the following commands:

Get all e-mail account passwords:

SELECT CONCAT_WS('@',mail.mail_name,domains.name),accounts.password
FROM domains,mail,accounts
WHERE domains.id=mail.dom_id AND accounts.id=mail.account_id
ORDER BY domains.name ASC,mail.mail_name ASC;

Email account passwords for a specific domain:

SELECT account_id AS �ID�, mail_name AS �USERNAME�, password AS �PASSWORD�, postbox as �MAILBOX?�, name AS �DOMAIN�, redir_addr as REDIRECT 
FROM mail M, domains D, accounts A 
WHERE M.account_id = A.id AND M.dom_id = D.id AND D.name=�****DOMAIN_NAME****�;

Get e-mail account passwords that are made up of only letters:

SELECT CONCAT_WS('@',mail.mail_name,domains.name),accounts.password
FROM domains,mail,accounts
WHERE domains.id=mail.dom_id AND accounts.id=mail.account_id
AND accounts.password RLIKE BINARY '^[a-z]+$'
ORDER BY domains.name ASC,mail.mail_name ASC;

Get e-mail account passwords that are made up of only numbers:

SELECT CONCAT_WS('@',mail.mail_name,domains.name),accounts.password
FROM domains,mail,accounts
WHERE domains.id=mail.dom_id AND accounts.id=mail.account_id
AND accounts.password RLIKE  '^[0-9]+$'
ORDER BY domains.name ASC,mail.mail_name ASC;

Find domains that are using catch-all accounts:

SELECT d.name AS domains, p.value AS catchall_address
FROM Parameters p, DomainServices ds, domains d
WHERE d.id = ds.dom_id AND ds.parameters_id = p.id AND p.parameter = 'catch_addr'
ORDER BY d.name;

Lookup FTP credentials:

SELECT account_id AS �ID�, login AS �USERNAME�, password AS �PASSWORD�, home AS �HOMEDIR� 
FROM sys_users S, accounts A 
WHERE S.account_id = A.id;