0

Renaming a domain in Plesk running on Linux

A tip for those who work with Plesk on a Linux platform:

Ever add a domain to Plesk and accidentally mis-spelled it? Or just want to change the domain altogether to something different (such as .com to a .net)? There are two ways to do this – within Plesk (the easy way) and within the command line (for advanced users).

In Plesk – Login as the client or admin (doesn”t matter) and go to your domain. Under the Domains section, click the button that says Domain Administrator. You will see a text box where you can manipulate the domain.

In the command line – Log into your server via SSH as root and change your present working directory to /usr/local/psa/admin/sbin. You should see a file in there named domainmng. If so, run the following to output the help section:

[root@yourserver sbin]# ./domainmng --help

Usage: domainmng [OPTIONS]...

(--turn-on | --turn-off) --domain-name=(domain_name) turn on/off domain

--rename-domain --old-domain-name=(old_domain_name) --new-domain-name=(new_domain_name) rename (old_domain_name) to (new_domain_name)

-h, --help display this help and exit

The –rename-domain flag is what we are looking for. So, to execute, run the following:

[root@yourserver sbin]# ./domainmng –rename-domain –old-domain-name=(your old domain here) –new-domain-name=(your new domain here)

The above is equivalent to the change you make in Plesk. Please note that these changes will not update your site’’s code, so if you have any hardcoded links, you”ll need to update them so that the new domain is being used.

0

Perl modules

Want to know what Perl modules are running on your server? Run this command from a SSH prompt:

perl -MExtUtils::Installed -e''my $inst = ExtUtils::Installed->new(); print $_, $/ for $inst->modules''

This is assuming you have Perl installed.

0

Number of connections on port 80

Ever wanted to know how many connections were coming to your server on port 80? Use the command below through a SSH terminal:

netstat -an |grep :80 |awk ”{print $5}” | sed s/::ffff://g | cut -d: -f1 |sort |uniq -c |sort -n

What does each command do? Let’’s break it down…

netstat -an

The netstat command allows you to find out what connections are actively listening on your server. The -a switch shows both listening and non-listening sockets. The -n switch shows numeric addresses instead of port or user names.

grep :80

Using the output from the netstat command, the grep command finds any sockets that are using port 80.

awk ”{print $5}”

Using the output from the grep command, awk parses the data that is in the 5th column.

sed s/::ffff://g

Using the output from the awk command, the sed command searches globally through the output and replaces the ”::ffff:” information with a space (the g is the switch for the global search).

cut -d: -f1

Using the output from the sed command, the cut command removes the colon symbol 1 field at the end of the string. The -d sets the delimiter (the colon) while the -f switch specifies the field number.

sort | uniq -c | sort -n

The last part of the command first sorts the output from the cut command and is then piped into the uniq -c command. The uniq command will report or omit duplicate results, while the -c switch will count the number of times the duplicates appear and display the number. The sort -n command will sort the final results of the command in numeric order.

Copyright © 2010 — | Site design by Trevor Fitzgerald