Solved

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

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now