One Liners

From Pleskforge

Jump to: navigation, search

Contents

Retrieve Plesk Admin Password

cat /etc/psa/.psa.shadow


Retrieve password from Plesk DB for email user

mysql -uadmin -p`cat /etc/psa/.psa.shadow` -e "use psa; select accounts.password FROM accounts JOIN mail ON accounts.id=mail.account_id WHERE mail.mail_name='webmaster';"


Retrieve FTP Password from Plesk DB

mysql -uadmin -p`cat /etc/psa/.psa.shadow` -e "use psa; select accounts.password from accounts INNER JOIN sys_users ON accounts.id=sys_users.account_id WHERE sys_users.login='xxxx';"

List the mail accounts and their aliases (listing is crude, but better than nothing...)

mysql -uadmin -p`cat /etc/psa/.psa.shadow` -e "use psa; select mail.mail_name as "account", mail_aliases.alias FROM mail_aliases JOIN mail ON mail_aliases.mn_id=mail.id;"

Make vhost.conf changes stick

/usr/local/psa/admin/bin/websrvmng -a -v
Then restart Apache.


Apache not working?

/usr/local/psa/admin/bin/websrvmng -a -v
Fixes 99% of problems.

Check user pop/imap logins to the server

This is limited to the amount of logged data you have...

 cat /usr/local/psa/var/log/maillog | grep "INFO: LOGIN"

or to check the old compressed logs:

 zcat /usr/local/psa/var/log/maillog.* | grep "INFO: LOGIN"

Of course, switch "cat" out for "tail -f" to watch users currently logging in, and add additional grep statements to look for a specific user

list all mailboxes and give you a total # on a server (thx gazoo!)

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

Find out the status of mail sent to XXXX@YYY.DDD in Qmail-Plesk

awk -v MAIL="XXXX@YYY.DDD" 'function err(msg){print (msg?msg:"Unrecognized log entry at line " NR)>>"/dev/stderr"} {IGNORECASE=1; if ($8 in LIVE) {if ($9=="success:") {print LIVE[$9] "\n" $0; delete LIVE[$9]} else if ($9=="failure:") {print LIVE[$9] "\n" $0; delete LIVE[$9]} else if ($9=="deferral:") {print LIVE[$9] "\n" $0; delete LIVE[$9]} else {err()}} else if ($0 ~ "starting delivery.+"MAIL) {LIVE[$9]=$0; print}}' /usr/local/psa/var/log/maillog
Personal tools