Solved

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

Posted on 2016-09-01
1
146 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ubuntu not booting - How get past GRUB? 3 76
Linux boot cd to do hardware report on PC? 3 76
SMB share across internet 15 79
EXCHANGE. LINUX, SYMANTEC MESSAGING GATEWAY 2 49
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
When it comes to security, there are always trade-offs between security and convenience/ease of administration. This article examines some of the main pros and cons of using key authentication vs password authentication for hosting an SFTP server.
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

679 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