Solved

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

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

Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
linux ssh 4 57
http to https 3 39
Regarding SecurityCRT issue 5 19
is my large folder zipped corrupted 4 49
We all know how boring and exhausting it is to transfer huge web projects developed locally to a webserver simply via FTP. The File Transfer Protocol is a really nice solution if you need to transfer small amounts of files, but if you're plannin…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
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.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

919 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

16 Experts available now in Live!

Get 1:1 Help Now