Friday, January 14, 2011

Qmail commands

How to manage Qmail queue in Linux Plesk

Plesk server uses qmail as a mail server. Following are some of the qmail commands for Plesk server.

1) To check the mail queue in plesk from command line, you can use the command :

# /var/qmail/bin/qmail-qstat

messages in queue: 10

messages in queue but not yet preprocessed: 0

2) You can examine the queue with qmail-qread.

# /var/qmail/bin/qmail-qread

q1

3) From the qread command you get the message’s id . In the above example , one of the id is 524514 . Now you can find the file holding the email in/var/qmail/queue with “find “command.

# find /var/qmail/queue -iname 524514

/var/qmail/queue/remote/22/524514

/var/qmail/queue/mess/22/524514

/var/qmail/queue/info/22/524514

4) From the mail header you get the IP address.

# vi /var/qmail/queue/mess/22/524514

q2

5) If you wish to remove the emails with some patterns , you can use qmail-remove ( You can download it from http://www.linuxmagic.com/opensource/qmail/qmail-remove )

# /etc/init.d/qmail stop (Stop qmail before removing)

# /var/qmail/bin/qmail-remove -r -p “Time Passing”

(considering that “Time Passing” was the subject of the email )

The above steps can be used to track Spammers .

Do you wish to completely remove all the mails from queue? Just run the below commands.

find /var/qmail/queue/mess -type f -exec rm {} \;

find /var/qmail/queue/info -type f -exec rm {} \;

find /var/qmail/queue/local -type f -exec rm {} \;

find /var/qmail/queue/intd -type f -exec rm {} \;

find /var/qmail/queue/todo -type f -exec rm {} \;

find /var/qmail/queue/remote -type f -exec rm {} \;

Sunday, January 9, 2011

Plesk commands

List of path to various log files in Plesk
Plesk Management

Following is the list of path to different log files on a Plesk server.

Plesk Installation Logs:

/tmp/autoinstaller3.log


Plesk Upgrade Logs including other applications:

/tmp/psa-...log


Plesk Access and Error Logs:

/usr/local/psa/admin/logs/httpsd_access_log
/var/log/sw-cp-server/error_log


Plesk Migration Logs:

/usr/local/psa/PMM/logs/migration.log


WatchDog Logs on Plesk:

/usr/local/psa/var/modules/watchdog/log/monit.log


Apache Web Server Logs on Plesk:

/var/log/httpd/access_log
/var/log/httpd/error_log


Apache Suexec Logs on Plesk:

/var/log/httpd/suexec_log


Access and Error Logs of a Website (account):

/var/www/vhosts/domain.tld/statistics/logs/access_log
/var/www/vhosts/domain.tld/statistics/logs/error_log


Mysql Logs on Plesk:

/var/lib/mysql/server.hostname.err (unless defined in /etc/my.cnf)


Named (Bind) Logs on Plesk:

/var/log/messages


Mail (Qmail and Postfix) Logs on Plesk:

/usr/local/psa/var/log/maillog


Ftp Logs on Plesk:

/var/log/messages


Server Logs on Plesk:

/var/log/messages


Horde Logs:

/var/log/psa-horde/psa-horde.log


Cronjob Logs:

/var/log/cron


SSH Logs:

/var/log/secure


Mailman Logs:

/var/log/mailman/


Tomcat Logs:

/var/log/tomcat5/catalina.out

Plesk container commands

http://kmaiti.blogspot.com/2010_05_01_archive.html

Virtuzoo commands

Virtuzoo commands
[root@test /]#vzctl start/stop/restart 101 // start the VPS 101
[root@test /]#vzctl enter 101 // enter into 101 VPS
[root@101 /]#exit // log out from 101 VPS
[root@test /]#vzlist // display the list of active VPS’s
[root@test /]#vzlist -a // display the list of all VPS’s
[root@test /]#vzcalc -v 101 // show resources usage on VPS
[root@test /]#vzctl exec 101 df -m // execute commands against the VPS(in this case ‘df -m’)
[root@test /]#vzyum 101 -y install package // install package using yum on VPS
[root@test /]#vzrpm 101 -Uvh package // install package using rpm on VPS
vzstat

Monitor resources usage of VPS

Monitor resources usage of VPS
1. Monitoring System Resources Consumption :

It is possible to check the system resource control parameters statistics from within a Container. The primary use of these statistics is to understand what particular resource has limits preventing an application to start. Moreover, these statistics report the current and maximal resources consumption for the running Container. This information can be obtained from the /proc/user_beancounters file.

command #vzctl exec 101 cat /proc/user_beancounters


The failcnt column displays the number of unsuccessful attempts to allocate a particular resource. If this value increases after an application fails to start, then the corresponding resource limit is in effect lower than is needed by the application.

The held column displays the current resource usage, and the maxheld column – the maximal value of the resource consumption for the last accounting period. The meaning of the barrier and limit columns depends on the parameter and is explained in the UBC guide.

Inside a CT, the /proc/user_beancounters file displays the information on the given CT only, whereas from the Hardware Node this file displays the information on all the CTs.

Validating Container Configuration(VPS)

Validating Container Configuration(VPS)
Validating Container Configuration : -

# vzcfgvalidate /etc/vz/conf/101.conf

The utility checks constraints on the resource management parameters and displays all the constraint violations found. There can be three levels of violation severity:
Recommendation >> This is a suggestion, which is not critical for Container or Hardware Node operations. The configuration is valid in general; however, if the system has enough memory, it is better to increase the settings as advised.
----------
Warning >>A constraint is not satisfied, and the configuration is invalid. The Container applications may not have optimal performance or may fail in an ungraceful way.
----------
Error >> An important constraint is not satisfied, and the configuration is invalid. The Container applications have increased chances to fail unexpectedly, to be terminated, or to hang.
----------

How to migrate VPS container to another virtuozoo node?

How to migrate VPS container to another virtuozoo node?
Guys,

I referred the following steps :

I executed following command from the old node :

====
[root@old_node ~]# vzmigrate IP_of_new_node 213:100
====

213 : CTID which will be moved to new node
100 : CTID which will be created on new node

It'll ask for the password of new node.

Here is the results :

======
[root@old_node~]# vzmigrate new_node_ip 213:100
root@new_node's password:
Connection to destination node (new_node) is successfully established
Moving/copying CT#213 -> CT#100, [], [] ...
Checking external bind mounts
Check cluster ID
Checking keep dir for private area copy
Checking SLM-only mode
Checking technologies
Checking disk usage space
Checking templates for CT
copy ez template area directories
copy /vz/template/centos/5/x86_64
Checking caches
Checking IP addresses on destination node
Check target CT name: clonedofvzold_node
Checking RATE parameters in config
Copy private area '/vz/private/213'
done
OfflineManagement CT#213 ...
done
vzctl : Running vzquota drop failed for Container 213 [11]
Successfully completed
======

Now assign new IP address for the CT 100 on new node by going at the network settings. Then restart the CT. You can now make multiple clone of this CT.

That's it. Try :)