Solved

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

Posted on 2016-09-01
1
160 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

Secure Shell (SSH) is a network protocol for secure data communication, mainly used to administer remote Unix / Linux servers via command line. But it also allows the user to open a secure tunnel between a client and a server where he can send any k…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.

751 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