Routing the world

Routing & IT System Administration

Archive for the ‘Linux’ Category

Creepy crashes on Ubuntu 14.10LTS or Elementary OS Freya

leave a comment »

The GDK environment in Ubuntu 14.10 and Elementary Freya is stable but old.

There is a reported but of Ubuntu pointing to GDK thread management issues: https://bugs.launchpad.net/ubuntu/+source/radiotray/+bug/1359564

To solve this look into creepy and disable the multi thread call: gtk.gdk.threads_init() in /usr/share/creepy/creepymap.py

Don’t forget to backup the file before edit it.

 

 

Advertisements

Written by Root

July 15, 2015 at 13:22

Posted in Linux

Tagged with , , , ,

Redirect Apache to Tomcat in Plesk 12

leave a comment »

When you have an application in Tomcat over Plesk and you want to redirect the domain to your application those are the instructions for Plesk 12:

  • Login as administrator
  • Select subscription
  • Open in control panel
  • Web server settings
  • Additional directives for HTTP && Additional directives for HTTPS:
RewriteEngine On
ProxyPass / http://example.com:8080/
ProxyPassReverse / http://example.com:8080/

Written by Root

July 1, 2015 at 15:59

Posted in Linux, Plesk

Tagged with , ,

Plesk Possible BUG: 11.0.9 #MU55 – Apache Webmail Wildcard missing by default

leave a comment »

I have detected a possible BUG in the default configuration of Plesk 11.0.9 at least in #MU55.

Working with the DNS Wildcard for Webmail I have found that the system does not create the ServerAlias Wildcard according to the DNS Zone in the Apache directives.

Recreate:
* Create a new domain with primary DNS zone
* Try to access to webmail.domain.tld. It must work correctly
* Try to access to whatever.webmail.domain.tld. It does not work and Plesk shows the default webpage.

Why?:
In Plesk 11 the Apache main directives are located under /etc/httpd/conf.d/. The main file that manage the vhost directives is zz010_psa_httpd.conf.

Into this file we can find that it points to another files, generated by Plesk, for example, when you reconfigure domains with /usr/local/psa/admin/bin/httpdmng –reconfigure-all

This is how zz010_psa_httpd.conf looks like:

Code:
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.
Include '/usr/local/psa/admin/conf/generated/13735297540.77229700_server.include'
Include '/usr/local/psa/admin/conf/generated/13735297540.77229700_horde.include'
Include '/usr/local/psa/admin/conf/generated/13735297540.77229700_atmail.include'
Include '/usr/local/psa/admin/conf/vhosts_bootstrap.conf*'

As we can see the webmails config is located under the /usr/local/psa/admin/conf/generated/

Well, this is where the possible BUG exists becouse into these files a ServerAlias directive for the wildcard should be created but it is not.

As default it creates

Code:
ServerAlias webmail.domain.tld

And it should create:

Code:
ServerAlias webmail.domain.tld
ServerAlias *.webmail.domain.tld

Solution:
I think that in the /usr/local/psa/admin/conf/templates dir, where are located the files that has the configuration template info used to generate the correct configuration, are not defined the wildcard pointers in the ServerAlias, so creating this pointers will solve the problem

I hope this info could help anyone with this kind of problems.

Written by Root

July 11, 2013 at 10:10

Delete messages from Postfix Queue based on from or to addresses

leave a comment »

When you need to delete messages from a Postfix Queue based on the From or To headers you can do it using the next “one-liner” commands:

  • For message deletion in a Postfix Queue based on From address

mailq | tail -n +2 | grep -v '^ *(' | awk 'BEGIN { RS = "" } { if ($7 == "address@mail.example.com" && $9 == "") print $1 } ' | tr -d '*!' | xargs rm

  • For message deletion in a Postfix Queue based on To address

mailq | tail -n +2 | grep -v '^ *(' | awk 'BEGIN { RS = "" } { if ($8 == "address@mail.example.com" && $9 == "") print $1 } ' | tr -d '*!' | xargs rm

What changes between the two commands is the position the awk command get to make parsing in order to obtains the MSGID before push it to delete command.

You could change "xargs rm" to "wc -l" to get the number of messages affected by the message group based on the From or To address. This must be done ALWAYS BEFORE delete the messages from the queue.

UPDATE 24/04/2013: If you are using a modern version of Postfix with queue in a complex directory structure, you have to change the last argument “xargs rm” to “xargs -rn1 postsuper -d“. This is done because postsuper command can delete messages from queue in all that complex structure and you don’t need to enter each directory to be able to delete the files.

Written by Root

April 24, 2013 at 09:00

Count the number of files per directory in the Filesystem

leave a comment »

When you need to know the number of files in a directory tree you can use the following sentence:

find ~ -type d -exec sh -c "fc=\$(find '{}' -type f | wc -l); echo -e \"\$fc\t{}\"" \; | sort -nr

Written by Root

April 22, 2013 at 10:24

MySQL diagnosis and troubleshooting

leave a comment »

To determine slow queries. We get the top 10 queries (-t 10) sorted by the number of occurrences in the log (-s c).
mysqldumpslow -s c -t 10

Search which Databases are un use based on the queries.
grep -C 1 "Data_Base_Query" mysql-slow.log | grep use | grep -v User | sort | uniq -c

Process List in MySQL Shell
mysql> show processlist;
mysql> show full processlist;

Chek and Repair Tables in All Databases
mysqlcheck -u root -p --auto-repair --check --optimize --all-databases

Written by Root

September 11, 2012 at 13:34

Posted in Linux

Tagged with , ,

Plesk Postfix Domain Based Smarthost

with 4 comments

In many situations a client needs to redirect all his mail to another SMTP server and you have the need to convert your Plesk Server for this domain to “SMTP Transport Mode“.

This is usefull for example, when a client has a hosting server or is hosted in a multidomain environment and wants to redirect all the mail received to his corporate mail server, like a Microsoft Exchange Server.

There is very few documentation about this in Parallels Forums and I know that can be a little bit scary to modify the Plesk Postfix Configuration Files. Don’t worry, this is what you have to do in five easy steps.

    1. Edit the file /etc/postfix/main.cf and if no set add the next two lines. In the first case, is allways defined, you have to add the last “hash”.
      virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual, hash:/etc/postfix/virtual_mailbox_maps
      transport_maps = hash:/etc/postfix/transport
    2. Create the transport file in /etc/postfix as defined before with this content. NOTE: example.com is the domain you want to transport mail to another SMTP.
      example.org smtp:[IP_or_Hosname]
    3. Create the virtual_mailbox_maps file with this content, this is done to maps all the email addresses to the end server:
      @example.com @example.com
    4. Make a postmap of both files, transport and virtual_mailbox_maps to make it Postfix readable
    5. Restart Postfix daemon “et voilá”

I hope this configuration will be helpfull to you. In this case leave a comment.

%d bloggers like this: