Thursday, 9 June 2011

Argument list too long?


To explain the problem, let’s consider what the shell does (we won’t get into system calls, to make things simple). The shell (Bourne compatible shells, actually) will first scan the line typed in. One of the first things to do is to expand file globs. For example, the command:
ls a*
will be translated by the shell into:
ls andrew apple alex allen alfred almonzo august axel albert
(and so forth). If the expansion expands beyond the system limitations, then it cannot be processed and the error “argument list too long” results.
The limit could be the number of arguments or the number of characters; however, the fix is the same. The key is to get the list (usually files) out of the argument list and into something else – such as stdout. Once the overlong list is being sent via stdout, the command xargs can be used to place all of the items on the command line, observing all relevant limits as it goes (and as efficient as possible to boot).
There are a variety of quick answers which will all fail, because the argument list would remain too long:
ls a* >savefile.txt
for i in a* ; echo $i ; done
echo a*
However, all is not lost: there are a number of ways to get a long list of files into stdout; the most common is to use find:
find . -name "CACHE.DAT" | xargs ls -ld
This may not be possible, if the desired list of files doesn’t fit neatly into a find command.
Another possibility, related to the previous example, would be this:
ls -1 | sed '/^a/!d' | xargs ls -ld
Yet another possibility might be to use a language like Perl; since it does not scan and process the same way, it would work without limitations:
perl -e 'opendir(DIR, "."); @all = grep /^a/, readdir DIR; closedir DIR; print "@alln";' | xargs ls -ld
I would only recommend using Perl or other such if you are quick and snappy with your knowledge of the language; otherwise, such a long line will have you looking things up repeatedly.
If the arguments are coming from a file, then things become even easier; instead of something like this:
ls -ld $(cat mylist)
You can simply use:
cat mylist | xargs ls -ld
Of course, any binary command can be used with xargs, not just ls.

Wednesday, 8 June 2011

All about AWstats Web Site Traffic (visitor) Log Analysis


  • How many visitors have viewed your site (per day, per month)?
  • Which pages are most popular?     Which files take the most bandwidth?
  • What browsers & OS are being used?
  • "How" viewers found your site?
  • What search terms were used to find your site in search engines?
  • What's the difference between hits and visits?
AWstats is our favorite of the web traffic analysis tools that SherwoodHosting offers free for you to analyze your visitor traffic.  The statistics analysis is re-run each night so you have an updated picture of your visitor profiles each next day.  End-of-month snapshots are kept and are accessible for the prior 12-month period.  If you need different parameter settings, you can always install AWstats (it's free!) on your own system (Windows, Mac, Linux, AIX, Solaris) and download your web site's log files and do custom analysis yourself.  However, the information we provide is likely more than you'll ever need (or want to try to absorb).
Some clients like to track the response to a mailing or other marketing. Others like to see what keywords (search terms) were used to find their web site. Be particularly careful not to confuse "hits" and "unique visitors" (although hits is a commonly used term and highly ambiguous, it is inflated for any useful interpretation of data other than trying to impress people how popular your web site is). For a small web site, 25-100 visitors per month may be quite good. Contact SherwoodHosting.com for information on how to drive traffic to your site through "SEO" (Search Engine Optimization) techniques for your web pages.
Below is additional information and examples of AWstats.
  • What is AWstats and its Features (details)
  • How to view your own AWstats analysis
  • Terminology AWstats uses
Example of the first part of an analysis report:


How to view your own Log Analysis:
For SherwoodHosting accounts, enter your domain name below
(example: domain.com;  no http, no www, & no slashes)
 

OR:
  1. Login to your Cpanel using your hosting account username and password
    (http://mydomain.com/cpanel)
  2. Depending on which version of Cpanel you use, it may look different from the screen shots below. In any case, scroll thru the choices and click on "Web/FTP Stats"
  3. Then Click on AWstats
  4. AWstats will show you the current month to-date (up until last night midnight), but you can choose other months (within the last 12 months)
(Step 2) Click on Web/Ftp Stats:

(Step 3) Click on Awstats

Explanation of Hits, Visitors, Unique Visitors, etc.

  • Traffic Viewed - Html (& PHP, etc) pages and images (& flash, MP3, WMV, etc) assets whose files were requested from http web accesses from our servers. 
  • Traffic Not Viewed - Files requested by robots (search engine cataloguing - a good thing!), as well as other web sites showing images that reside within your own web site. (This is particularly worrisome for large numbers of audio and video files with large sizes that are shown as a part of someone else's site, but you pay the bandwidth quota charges for them.)
  • Unique Visitors - Even though a visitor may return to your site multiple times within one month (and even view the same page with possibly new updates on it/fresh content), this counts as one unique person visiting your web site in the given month. 
  • Number of (individual) Visits - Even though several pages may be browsed, a given visitor for a specific time period of the visit counts as one visit. 
  • Pages (displayed) - Number of html (htm), PHP, CGI, etc. web pages requested. 
  • Hits - Number of URL web addresses requested from your web site, especially including html, php, all images (especially slices that make up a larger picture), etc. 
  • Bandwidth - The total sum of all the file sizes for files displayed/transferred to and from our servers from your web site.
Note the differentiation between the terms "hits" and "visits."   One visit is counted when one computer accesses one or more of your web pages and/or images during a given time period-- this is a pretty accurate accounting of what you probably want to know about the browsing of your web site. Many commercial sites boast using the term hits, because one person visiting one page on a site could accumulate maybe 50 hits (due to a matrix of image slices used to build the graphics on a front page and navigation menus and rollovers).

Webmail Interface with Atmail is now available on cPanel


Atmail one of the world’s most popular webmail clients is now available for  installation with cPanel & WHM version 11.28 or later.
Installing Atmail Open Source can be done within few clicks :
  1. Log into WHM with root privilege.
  2. In the left-hand menu, click on Manage Plugins.
  3. Check the “Install and keep updated” checkbox for the Atmail Open Source  plugin.
  4. Click the Save button at the bottom of the page.
Now, when users log into webmail, they’ll have the option to use Atmail webmail interface.
If at any time you decide to stop offering Atmail Open Source, simply return to the Manage Plugins screen in WHM and click the button to uninstall.

Monday, 6 June 2011

Bandwidth Limit Exceeded user/domain

From WHM :

To bring the website back online or un-suspend the bandwidth exceed-er, use the option
WHM >> Account Functions >> Unsuspend Bandwidth Exceeders >> click “Proceed”.

This will reset the bandwidth usage to zero for the account. To increase the bandwidth limit for the account, use the option

WHM >> Account Information >> “View Bandwidth Usage”

From Shell :

vi /var/cpanel/users/USERNAME
change BWLIMIT (Increase the value)
/scripts/updateuserdomains
cd /var/cpanel/bwlimited/

remove the files related to that user or domain
OR
rename the fies with suffix _bk
e.g.;
user_bk
domainname.com_bk
www.domainname.com_bk

This will bring the website back online..

Saturday, 4 June 2011

Installing an SSL Certificate in Parallels Plesk Panel


About the Intermediate Certificate

Before you install your issued SSL certificate, you must install our intermediate certificateon your Web server. An intermediate certificate is a subordinate certificate issued by the trusted root specifically to issue end-entity server certificates. The result is a trust-chain that begins at the trusted root CA, through the intermediate, and finally ending with the SSL certificate issued to you. Such certificates are called "chained root certificates."
Intermediate certificates provide an added level of security because the CertificationAuthority (CA) does not need to issue certificates directly from the CA root certificate.
The intermediate certificate must be installed on the server bundled with our ValiCert root certificate
Once you have downloaded the bundled certificate, intermediate certificate, and your issued SSL certificate, please follow the instructions below to install them on your Webserver.

To Install SSL and Intermediate Certificates in Parallels Plesk Panel 8.x

  1. Log in to Parallels Plesk Panel.
  2. From the left-hand menu, select Domains.
  3. Click on the domain name that the certificate is issued for.
  4. Click on the SSL Certificates menu item.
  5. Click Browse and locate your signed SSL certificate.
  6. Select it, then select Send File - this uploads and installs the certificate against the corresponding private key.
  7. On the displayed list, click on the name of the certificate.
  8. Open the certificate bundle (gd_bundle.crt) in a text editor and copy and paste its contents into the box labeled CA Certificate.
  9. Click the Send Text button.
  10. Click Up Level; then choose Setup.
  11. At the top of the page, change the SSL Certificate drop-down menu to thecertificate you have just installed.
  12. Click the Server item from the left-hand menu.
  13. Click Service Management.
  14. If your server is running Linux, stop and start the Apache process. If your serveris running Windows, start and stop the DNS service.
    NOTE: Simply restarting Apache will not work. Stop the service and start the service again to complete the installation.

To Install SSL and Intermediate Certificates in Parallels Plesk Panel 9.x

  1. Log in to Parallels Plesk Panel.
  2. From the left-hand menu, select Domains.
  3. Click on the domain name that the certificate is issued for.
  4. Click on the Certificates menu item.
  5. Click Browse and locate your signed SSL certificate.
  6. Select the certificate file and then click Send File.
  7. Navigate to the location of the saved site certificate you received from us. Select it, then select Send File - this will upload and install the certificateagainst the corresponding private key.
  8. On the displayed list, click on the name of the certificate.
  9. Open the certificate bundle (gd_bundle.crt) in a text editor and copy and paste its contents into the box labeled CA Certificate.
  10. Click the Send Text button.
  11. Click Up Level.
  12. Click Up Level again.
  13. Select Web Hosting Settings.
  14. At the top of the page, change the SSL Certificate field to the certificate you just installed and then click OK.
  15. Click Home.
  16. Click Service Management.
  17. If your server is running Linux, stop and start the Apache process. If your serveris running Windows, start and stop the DNS service.

To Install SSL and Intermediate Certificates in Parallels Plesk Panel 10.x

  1. Log in to Parallels Plesk Panel.
  2. From the Hosting Services menu, click Domains.
  3. Next to the domain name you want to use, click Control Panel.
  4. Go to the Websites & Domains tab, and then click SSL Certificates.
  5. Under Certificate name, click the certificate you want to use.
  6. Next to the Certificate field, click Browse.
  7. Locate your signed CRT file, e.g., coolexample.com.crt, and then click Open.
  8. Next to the CA certificate field, click Browse.
  9. Locate the certificate bundle, gd_bundle.crt, and then click Open.
  10. Click Send File.
  11. If your server is running Linux, stop and start the Apache process. If your serveris running Windows, stop and start the DNS service.

Friday, 3 June 2011

How to Flush the DNS Cache in Mac OS X


Do you know how to flush the dns cache in mac os x? This Mac tutorial guide helps you make it out.   You will need software: DNS Flusher    
DNS Flusher is a simple tool to flush the DNS cache in Leopard (10.5) and Tiger (1.04), the steps below will show you how to flush the DNS cache.
Guide on Flushing the DNS Cache in Mac OS X
1. Download DNS Flusher
Download the DNS Flusher if there isn't a DNS Flusher on your Mac, then install it.
2. Run the application
launch the application, navigate to "Applications/Utilities/Terminal" and double click on the "Terminal" application.
3. Enter command
In your new window, enter the following command if you are using Mac OS X 10.5 Leopard:
dscacheutil - flushcache
Note:If you are using Mac OS X 10.4 Tiger, enter the following command in your new window:
lookupd - flushcache
5. Finishing flushing
DNS Flusher
Once you have entered the above command, your DNS cache has been successfully flushed. Any issues with resolving IP addresses and host names in the DNS cache should be resolved.

Wednesday, 1 June 2011

Linux / UNIX set the DNS from the command line


Under Linux / UNIX / BSD operating system, you need to edit the /etc/resolv.conf file and add the line:
nameserver {IP-OF-THE-DNS-1}
nameserver {IP-OF-THEISP-DNS-SERVER-2}
Login as the root, enter:
# vi /etc/resolv.confOR
$ sudo vi /etc/resolv.conf
Modify or enter nameserver as follows:
nameserver 208.67.222.222
nameserver 208.67.220.220
Save and close the file. To test DNS configuration type any one of the following command:
$ host google.com
$ dig google.com
$ ping google.com
$ nslookup your-domain.com
Output:
google.com has address 72.14.207.99
google.com has address 64.233.187.99
google.com has address 64.233.167.99
google.com mail is handled by 10 smtp4.google.com.
google.com mail is handled by 10 smtp1.google.com.
google.com mail is handled by 10 smtp2.google.com.
google.com mail is handled by 10 smtp3.google.com.
If you see valid output such as actual IP address or able to ping to remote server via hostname, it means that the dns is working for you. Also make sure you have valid default gateway setup, if you see the time out error.