Useful commands on plesk
September 29th, 2006 by
eglennkelly
Ok, I’ve made a text file of all those tricky commands I use on plesk FC2. Many of them have saved my bacon, or just been really useful
Get ftp Resume to work
http://forum.swsoft.com/showthread.php?s=3801b6aad2b9f7efded662d50eb0afa2&threadid=25415&highlight=ftp+resume
Login via SSH as root
then open the file /etc/proftpd.include
(to open it just type:
code:
nano -w /etc/proftpd.include
or
code:
vi -w /etc/proftpd.include
)
that should be an empty file…
at this point you have to place inside it this line:
code:
AllowStoreRestart on
then save and exit (ctrl + x if you use nano)
then type at SSH prompt:
code:
/etc/rc.d/init.d/xinetd restart
your FTP service will be restarted and you can resume interrupted downloads (the ftp server now will accept the APPEND command) 
some other usefull tweaks to put inside your /etc/proftpd.include are also:
faster login:
code:
UseReverseDNS off IdentLookups off
(in theory that 2 ones had beed added in 7.5.3…)
and this one that force your ftp to show all the files included .htaccess and so on 
code:
ListOptions “-a”
view server messages:
cat /var/log/messages | tail -200
disk usage
du -sk*
Plesk Passive FTP ‘connection timeout’ error fix
I’ve had some problems with my plesk on godaddy servers using ftp. The connection often times out. Connecting from home, I found that turning off the ‘application gateway service’ on my computer ( windows ) worked.
But this site http://andryan.wordpress.com/2006/01/23/passive-ftp-workaround-for-plesks-proftpd/ suggests defining the passive ports and opening them on the firewall as follows:
“…
Add the following line:
PassivePorts 49152 65534
to /etc/proftpd.conf
NOT /etc/proftpd.include as that file will be overwritten by Plesk regularly.
No need to restart xinetd (/etc/init.d/xinetd restart) as proftpd is executed only when a connection has been attempted on the port.
Add the following line:
/sbin/iptables -A INPUT -p tcp –dport 49152:65534 -j ACCEPT
to /usr/local/psa/var/modules/firewall/firewall-active.sh
That’s all!
Just need to make sure that the last incoming traffic rule is set to deny all.
Valid for Plesk 7.5. …”
I tried it and it looks like it’s working, more updates soon …
Change Ownership
chown user:group * -R
eg chown apache:apache * -r
( only apache can change the files)
Fix plesk updater problems
mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -e’delete from PMM’
Optimize all mysql tables
mysqlcheck -o -u admin -p`cat /etc/psa/.psa.shadow` –all-databases
To move mysql databases around
Export/Import
First dump the whole database to file
In phpmyadmin: -
1. export
2. select all tables
3. compression .gz
4. compatability none
5. Download the file
6. Open file.sql in editor
7. remove all
ENGINE=MyISAM DEFAULT CHARSET=latin1
8. Resave
9. .gzip up
10 Upload to server
11. log in to server ssh
12. go to dir with the .gzip
13. ungzip file.gz
14. type mysql db -p -u user
then enter the password
15 type: source file.sql
UTF-8 and MySQL
SET NAMES ‘utf8′
When using MySQL’s UTF-8 character set, besides setting the database character set to UTF-8, you must remember to send SET NAMES ‘utf8′ to MySQL prior to querying or inserting. Forgetting to do will surely cost you a substantial amount of hair, sleep, and sanity.
View Processes
ps -aux
View live processes
top
Zip Files
zip -r back_2006_04_05 *
Restart apache ( httpd )
/sbin/service httpd restart
Restart mysql
/sbin/service mysqld restart
Install Zend Optimizer
tar -zxvf Zend*
cd Zend*
./install.sh
untar file.tar.gz
tar -zxvf file.tar.gz
upgrading php and mysql
http://forum.ev1servers.net/showthread.php?t=51695
Disable SpamAssassin
http://forum.swsoft.com/showthread.php?s=7dd484ae4a36e0d393e801651615342e&threadid=15092&highlight=disable+spamassassin
Here are steps how spamassasign can be disabled:
1. chkconfig –level 0123456 spamassassin off
2. Open the file /etc/init.d/psa in your editor.
Find this string:
optional_service=”postgresql spamassassin ${PRODNAME}-spamassassin”
change it with
optional_service=”postgresql”
Improve SMTP speed
http://forums.spry.com/showthread.php?t=411
Edit
/etc/xinetd.d/smtp_psa
What you are going to do is, add “-Rt0″ to “server_args”. It will then look like this:
server_args = -Rt0 /var/qmail/bin/relaylock /var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true
Save the file, and restart xinetd by issuing this command:
/etc/init.d/xinetd restart
Clear mail queue and stop double bouncebacks
http://forum.swsoft.com/showthread.php?s=646617aa5edfa86fcda65c641effc152&threadid=36297
#2) Kill double bounce backs!!!!!
in /var/qmail/control/ :
echo # > doublebounceto
#3) Flush your existing qmail-queue
Proceed with caution. After setting no doublebouncebacks, I totally cleared my queue.
/var/qmail/queue/
I cleared this out totally:
service qmail stop
rm mess/*/* –force
rm info/*/* –force
rm remote/*/* –force
rm local/*/* –force
better ftp transfers
I had to transfer one site from a dodgy host, to my shiny new godady plesk server.
However, every time I started up the old mget *, I go ‘Remote host has closed the connection‘ errors.
What to do? There were too many files to get and check separatly …
So, I found ncftp, luckily it was already installed on my machine. And it does recursive mgets as well! Anyway, here’s the connect command:
ncftp -u username -p password host.com
Better unzipping - unzip multiple zips at once
Once all the files had been transfered, and I had to restart a few times due to further connection losts, this little command unzips them all. PS I haven’t found out how to deal with spaces in file names yet ..
for i in *.zip; do unzip $i; echo next?; read e;done
Increase IMAP Connections
from: http://www.inertramblings.com/2006/09/22/add-more-courier-imap-connections-under-plesk/
Plesk comes configured with a limit of 4 connections per IP address and a limit of 40 connections total. Modern IMAP clients such as Mozilla Thunderbird use mailbox caching to open up multiple connections to increase performance. In the case of Thunderbird, it opens up 5 connections by default which is already 1 connection more than Courier-IMAP’s default restriction. Add another few family or corporate computers behind a firewall and those additional users won’t be able to connect at all since a single Thunderbird client is already utilizing all 4 connections.
To increase this restriction, modify the /etc/courier-imap/imapd configuration file and change MAXDAEMONS and MAXPERIP to a more sane number. In the case of my configuration, I changed MAXDAEMONS from 40 to 80 and MAXPERIP from 4 to 40. This allows all the machines behind my home firewall to connect to multiple accounts on the e-mail server with mailbox caching enabled.
View maillogs
tail /usr/local/psa/var/log/maillog -f
Posted in Internet, Servers, Plesk, Linux |
No Comments »
