Solved

Rebuild awstats from SSH command line on CentOS, from awstats txt files from another server

Posted on 2016-09-01
1
133 Views
Last Modified: 2016-09-05
I have migrated from a CentOS 5 VPS with HostGator (running cPanel), to running CentOS 7.2 with Plesk on Azure. The latter is working great, far faster than my old setup.

I have successfully run all website migrations using the Plesk Migrator Extension. However, the one thing I have not got back is the awstats. On close insepction, the place that the HostGator CentOS / cPanel install and the place that the new Azure CentOS / Plesk install store the files is different. There seems to be a shift in how the folders are structured too, and the labelling format of the files.

I have appropriately renamed the awstats txt files and dumped them in what would seem the correct location on the new setup. I have run the rebuild command listed here: https://kb.plesk.com/en/115476, but it only rebuilds for the months since the migration took place (Aug & Sep 2016).

My approach I can only assume is wrong. This is how I have always done it in the past (I've migrated providers a few times), but it doesn't seem to work - or maybe i just need to wait until awstats auto-runs some kind of reacknowledgement task every 24 hours and imports to it's db?

I did read somewhere there is a perl script that can be run - but I can't find this, and don't currently have perl installed on the server.

Cheers in advance for any helpful thoughts!
0
Comment
Question by:bluemercury
1 Comment
 
LVL 1

Accepted Solution

by:
bluemercury earned 0 total points
ID: 41784709
OK - I finally worked this out for myself.

First, as I alluded to in my question, you need to rename your existing awstats.txt files, so that they are in format of awstats092016.domain.com-http.txt (replacing domain.com with your actual domain name, and the date should already be in that format). I used the batch rename tool in Adobe Bridge for renaming (comes with a Adobe Photoshop trial).

Then connect to your server that runs Plesk (I recommend WinSCP for this task, and you will ideally need the 'root' account made directly accessible, at least whilst you carry this out). Browse to the location:

/var/www/vhosts/system/domain.com/statistics/webstat

Drop in your awstats txt files.

I then found a modified version of rebuild_awstats.sh on the Plesk forum. This hadn't worked before, because there are some incorrect lines of code in it for versions of Plesk higher than 11.5. I corrected these. In addition, alter the date range (in notepad++ or whatever) on line 294 to suit the date range of stats you want to rebuild. I've attached the stats.sh file to achieve this. Copy this to a folder on your server that you can execute scripts from, and run it in the form of:

./stats.sh domain.com

Watch as your SSH command line shows the html folders getting rebuilt, and at the end you should be able to navigate and see all your awstats no problem.

I hope that explains what I did well enough - good luck anyone else looking to do this!
stats.sh
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Viewers will learn how to properly install and use Secure Shell (SSH) to work on projects or homework remotely. Download Secure Shell: Follow basic installation instructions: Open Secure Shell and use "Quick Connect" to enter credentials includi…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question